I am trying to get the high and low of a given bar that i click the mouse on. I understand using the ProcessMouseEvents and all that. But I have a hard time getting the values for the bar clicked...

I am trying various ways, but with no luck. .. Sometimes I am getting vBarsAgo as a number less than 0, so I am not sure what I am doing wrong, or how I should approach the problem..

Code: Select all

```
```

if MouseClickShiftPressed then begin

vClickBarNbr = MouseClickBarNumber;

[code] //vLastBar = currentbar;

vLastBar = barnumber;

vBarsAgo = vLastBar-vClickBarNbr ;

if vBarsAgo >= 0 then begin

vClickBarHigh = high[vBarsAgo];

vClickBarLow = low[vBarsAgo];

print ("high = " + NumToStr(vclickBarHigh,2) + " Low = " + NumToStr(vclickBarLow,2));

end

else begin

print ("bar= " + NumToStr(vBarsAgo,0) + " Low = " + NumToStr(vclickBarLow,2));

end;