Hi Guys,
Not sure how to word this so here goes.
I want to set stop loss & take profit based on low of 2 candles ago. the stop loss is to use an EMA as the stop ie: if low[2] is below EMA[20] the stop loss is to be at EMA[50].
further to this i would like to set take profit at 1.5* the stop loss.
Apologies if this has been covered before i searched the forums but could not find a suitable solution.
I have also had no luck trying to code this myself & have just failed miserably. any help is appreciated 🙂
cheers
There you go:
Ema20 = average[20,1](close)
Ema50 = average[50,1](close)
IF low[2] < Ema20 THEN
SL = abs(close - Ema50) //Stop Loss set to the difference between current price and Ema50
TP = SL * 1.5
SET STOP LOSS SL
SET TARGET PROFIT TP
ENDIF