How to fix a candle parameter?

 

hi,

I have a problem. I wish to fix this parameter   High[1]-Low[1]  for obtain a steady trailing step, but obviously this code, as soon as there is new candle is updated.

I'd like to create a simple function for returns steady distance between (start high candle) - (star low candle) to insert under the last return.

How can I do?

Thanks

 

DOC 

 
DottorMarket:

hi,

I have a problem. I wish to fix this parameter   High[1]-Low[1]  for obtain a steady trailing step, but obviously this code, as soon as there is new candle is updated.

I'd like to create a simple function for returns steady distance between (start high candle) - (star low candle) to insert under the last return.

How can I do?


Keep track of the "start candle" time then use iBarShift(NULL, 0, StartCandleTime) to get the bar number and use this with  High[] and Low[] 
 

thanks Raptor for your kindness.

I don't know how keep track of start candle. Can you show me an extended code example, please? 

 
DottorMarket:

thanks Raptor for your kindness.

I don't know how keep track of start candle. Can you show me an extended code example, please? 

OK,

datetime StartCandleTime;


StartCandleTime = Time[1];

 Set StartCandleTime when you want to keep it's value, reset it hen you want a new value.  Then use it in iBarshift()

 
thanks :)
Reason: