0
Green = Bar_Color == color.new(#04E819, 0)
MA_Long = MA_Entry == 'Aggressive' ? l_C <= SMA_Out : c_C <= SMA_Out
Stoch_Long = Stoch_MTF_6H <= Stoch_Lower
Close_Long = Stoch_MTF_3H >= Stoch_Upper



Long_signal = Green and MA_Long and Stoch_Long and Hour_Filter and Day_Filter and Volume_Signal

I am trying to make the variables inside "Long_signal" optional so that way I am able to enable or disable specific ones. What is the best way to do this?

I expected to use the bool function but im not sure how to properly format it to make it work the way I want.

Brenda L.
  • 1
  • 3

1 Answers1

0

You use a bool variable to enable/disable and set your condition to true if it is disabled so that it doesn't affect your anded conditions if disabled.

Stoch_Long_en = input.bool(true, "Enable Stoch_Long?")
Stoch_Long = Stoch_Long_en ? (Stoch_MTF_6H <= Stoch_Lower) : true

Then use this Stoch_Long as normal. If it is enabled, its value will be checked. If disabled it will return true so it will not affect the final result of Long_signal.

vitruvius
  • 15,740
  • 3
  • 16
  • 26