Can you generate a switch like mechanism using bools on an indictor ?

 

I am struggling to generate a switch using booleans.

Essentially

if(UPTREND)

{

Up=true

Down=false

}

if(DOWNTREND)

{

Down=true

Up=false

}


So when market UPTRENDED based on criteria Up=true Down=false

This would only change when DOWNTREND criteria were met and so on.

Currently i seem to be only able to activate it for the individual candle the criteria is met on and then both UPTREND and DOWNTREND are reset to false. I need the true boolean to remain true until the opposite one is switched to true.

Hopefully this makes sense. Thanks for the pointers :)

 
torexvir:

I am struggling to generate a switch using booleans.

Essentially

if(UPTREND)

{

Up=true

Down=false

}

if(DOWNTREND)

{

Down=true

Up=false

}


So when market UPTRENDED based on criteria Up=true Down=false

This would only change when DOWNTREND criteria were met and so on.

Currently i seem to be only able to activate it for the individual candle the criteria is met on and then both UPTREND and DOWNTREND are reset to false. I need the true boolean to remain true until the opposite one is switched to true.

Hopefully this makes sense. Thanks for the pointers :)

Just set Up & Down variables as global ?