Good morning, sorry to bother everyone again with my silly questions.
I am trying to set a trailing stop loss at a recent low of the x day close.
Using multi time frame I have set the variable like this:
1
2
3
Timeframe(daily,updateonclose)
LongExit=lowest[200](close)
Timeframe(default,updateonclose)
I have used GRAPH to check what LongExit returns and it works correctly, it gives me the lowest close of the last 200 days and it updates at the close of the daily bar.
The default timeframe is HOURLY.
I want to use ‘LongExit’ as a trailing stop loss. I have this:
1
2
3
4
IFlongentryconditionsTHEN
BUYPositionSizePERPOINTATMARKET
SET STOPpTRAILING(Close-LongExit)
ENDIF
I want it to ONLY MOVE THE STOP at the close of the day, when LongExit changes?
At the moment it is moving the stop continually in steps of 1, every time the live price moves upwards by 1 point.
What if I did it this way instead, would this move the pending stop order each day as the value of the variable LongExit is updated at the daily close?
The SET TRAILING instruction attach a trailing stop to the order that is then handle by the broker, so calling this instruction again will have no effect on when the stoploss will be moved.
Your second example is the good one. Since the “LongExit” variable will be updated once every day, therefore the pending order level will change only once too.