SET SL = REF(LOW,1) SET profit = Ref(high,1) + ((Ref(high,1) + Ref (low,1) * 2) Crossover(Low, SL) = True or Crossover(High, profit) = True
In the above code of PI, the SL and Profit are changing according to the candle which has been worked out by the script.
How to create or SET a constant value for a variable until a new trade is triggered? I have kept the SL as the low of the candle at which the buy signal was triggered and the Profit is twice the size of that candle. But the above code keeps changing the SL and profit values to subsequent candles.
Pls suggest me how to code correctly or give me hints to where to find the correct approach