MrBackwardation
New member
Hello, I had a request for a formula that trails a stop based on the cross of a price level. It would also preferably detect whether an entry is long or short, but I have a sloppy workaround if that's not possible (I set a parameter for if entry price is between two levels).
For example, if stock X has levels of A, B, and C, I want to have a stop at A when price is entered at D. If price closes above B, I want to move my stop to E. And if price closes above C, I want to move my stop to F.
I have tried creating an "if A then D else if B then E else if..." chain for my parameters, but it does not plot. I've tried utilizing the "close crosses over A" terminology, but for some reason it does not work. Here is my failed attempt:
The notable levels are h4, h4m, h5, then h5+5,10,15...
Thanks in advance!
For example, if stock X has levels of A, B, and C, I want to have a stop at A when price is entered at D. If price closes above B, I want to move my stop to E. And if price closes above C, I want to move my stop to F.
I have tried creating an "if A then D else if B then E else if..." chain for my parameters, but it does not plot. I've tried utilizing the "close crosses over A" terminology, but for some reason it does not work. Here is my failed attempt:
Then I would have created a condition to detect if the trade was long, then simply sell to close when low crossed below the R4_trail.plot R4_trail = if close > h4 then stopLevel_h3m_L
else if close crosses above h4m then stopLevel_h4_L
else if close crosses above h5 then stopLevel_h5_L
else if close crosses above (h5 + 5.00) then (stopLevel_h5_L + 5.00)
else if close crosses above (h5 + 10.00) then (stopLevel_h5_L +10.00)
else if close crosses above (h5 + 15.00) then (stopLevel_h5_L +15.00)
else if close crosses above (h5 + 20.00) then (stopLevel_h5_L +20.00)
else if close crosses above (h5 + 25.00) then (stopLevel_h5_L +25.00);
The notable levels are h4, h4m, h5, then h5+5,10,15...
Thanks in advance!