Debugger - Values for selected Candle

Hi,

I am new to Amibroker and have been learning on the basis of various internet and forum posts. I could not find any relevant post on my query and hence this post. If there exists a post, I would be much obliged if someone could point me towards it.

When evaluating the various variables, I have used the printf functions previously to see what the actual value of the array is for the selected candle. I have started using the Debugger and Watch now but it shows the entire array set and not for the selected candle. Is there some way to do it?

Newbie

You can still use printf() in the debugger (Output window) and you can display selected value of array using SelectedValue( array ) or array[ BarCount - 1 ] (because in debugger selected value is last one)

For me the normal barcount -1 option gives the value of the feed of the current date and not the candle I have selected in the chart screen via Double Click. Basically the printf and the Barcount -1 values do not match (not sure if I am selecting the candle incorrectly)

I know you will say RTFM very soon but trying my luck anyway

You need to understand that AmIBroker is multithreaded application.
Everything runs in parallel and has "separate life". Debugger is NOT connected to any of your (possibly multiple) charts. It is separate, as every chart is separate from each other and separate from analysis window as well. These all run in parallel threads, living in their own worlds.
Debugger runs in separate (backtest) context, not in chart context, therefore it does not know/care what you clicked on of possibly many opened charts. The selected bar in the debugger is the last bar. Selected bar is individual/independent property of single chart.

The only global selection that works across all charts, analysis and debugger are global range markers accessible via BeginValue/EndValue functions, see range markers in the manual
http://www.amibroker.com/guide/h_charting.html

okay, I understand now.

To help with contextual troubleshooting of code, is there a way to write some lines of code such that Debugger runs on a specific date only? I am really looking to avoid having to print each variable to see the output and was hoping that Debugger would solve my problem of speed of development. If not, print is the way to go I guess

Ritesh

Sure, open up Watch window in the debugger and click on Arrays tab - there you can see values of any 'watched' array at any day easily.
http://www.amibroker.com/guide/h_debugger.html

1 Like

One last question on this issue. Is there a way to make Debugger just run for a specific date?