Trend setting

 

Hi,

does anybody got some idea how to fix the trend in custom indicator ??

For example, If indicator made six lines above value 100, say there is Uptrend. 

Then I need program, to do not get back to upper functuion "if"  unless Uptrend is cancelled by some event in the indicator..

thank you for all ideas... 

 
Don't look for a level, look for a change in signal
static bool uptrend = false;
bool upTrendPrev = uptrend; uptrend = YOURCONDITION;
if(upTrend && ! upTrendPrev) CHANGED;
 

I got it, thanks :)

Reason: