Hi all, first post. Apologies if this has been covered, I tried searching and couldn’t find what I was looking for. I’m new to programming and may be missing something really obvious.
I have set my profit target to ATR*1, and stop to ATR*3. However, I also want to have a fixed stop amount so I don’t get a blowout loss (i.e. if the loss gets to 30, just close the position).
How would I go about doing this?
// Conditions to exit long positions
c51 = MyATR*1
c52 = MyATR*3
// Stops and targets
SET STOP pLOSS c52
SET TARGET pPROFIT c51
You can’t have two stop losses because price has to pass through at least one of them to get to the other one!
You could set a minimum level though:
MaxStop = 30
c51 = MyATR*1
c52 = Min(MaxStop,MyATR*3)
// Stops and targets
SET STOP pLOSS c52
SET TARGET pPROFIT c51