Hi,
I am writing an indicator where sometimes I want to calculate against all bars, and sometimes only against the most recent bar.
Effectively I want to be able to use “DEFPARAM CalculateOnLastBarOnly” but within an IF statement driven by a boolean variable declared against the indicator ( thereby allowing a user to control the output ).
However, from what I can see the DEFPARAM can’t be placed within an IF, and so I need to code this for myself.
How do I detect ( elegantly !! ), if I am currently working against the “current” candle ?
This indicator can be used against ANY timeframe, and so comparisons against currenttime become quite messy, quite quickly.
BarIndex effectively numbers from the beginning of the available bars – I need the inverse of BarIndex, so that I’m at 0 when on the current bar.
Does anyone have any elegant solutions ?
Regards,
Bob