I want a Trailiing Stop loss in my strategy. That moves if some conditon are met and then stays there.
In short i want to set the Level of the SL myself as inputs.
IF > 2% = 1% If RSI crosses yx =3,5 %Sl if Price cross BB line up = o SL and so
for example.
I start with a Standart fixed SL.
After the price moves over +2" i want the SL to move to Break even
then if the price hits hits multie conditons i want the SL move again.
Try a alot of different possibilities. but could make it to more
Last Try.
inputSlmove1 = 3*0.01
inputSLmoveset1 = 1*0.01
inputSlmove2=5*0.01
inputSLmoveset1=2*0.01
SLtrigger = strategy.position_size > 0 and crossover(src1,strategy.position_avg_price * (1 + inputSlmove1))
SLtrigger2 = strategy.position_size > 0 and crossunder(src1,strategy.position_avg_price * (1 + inputSlmove2))
SLset1= strategy.position_avg_price *(1+(inputSLmoveset1*0)
Slset2=strategy.position_avg_price* (1+inputSLmoveset1)
SLL1 =0.0
if Sltrigger
SLL1 := 1.0
if SLL1[1] == 1.0
SLL1 := 1.0
else
na
if SLL1 ==1
SLset1
if SLtrigger2
SLL1:=2
... and so on
plot(SLset1 and strategy.position_size > 0, style=shape.triangledown ,location=location.abovebar, color=#388e3c, size=size.small, title='BB Buy 3')
Aucun commentaire:
Enregistrer un commentaire