I am having a lot of problems with a Stop Loss indicator I am trying to develop.
I have been able to plot the calculations (It just calculates the minimum using MIN function of the last X bars, and draws that line.
However, I want the plot NOT to go down until I set a reset condition, so I need to compare each calculated data with the previous days data, and if it is smaller, use the previous day value. And this applies for everyday of course
Eg.
if (stoplosstoday<stoplossyesterday)
then
stoploss=stoplosstoday
else
stoploss=stoplossyesterday
I had a lot of problems, specially because double ans series variables get mixed.
Can you give me some guidance on how to work this out?

Thank you

Historicity has nothing to do with the matter. An OnBarUpdate is an OnBarUpdate. Granted there is only one per bar on historical bars, but why should that matter? Especially, as you seem to be talking about daily bars anyway.

Comment