Try commenting out lines 150-151, then adding these lines at line 154:
-Does this mean that I should make this change also in a v5.3 that I am running?
-Also change on the short side if running that?
-Does it affect results in backtest or is it only in live trading it makes a difference?
I don’t know that code!
I just read it because of the question.
The short side is not affected by those changes.
It simply adds the stop loss when it was missing, be it live or backtest.
I’ve had this problem too, sometimes the stops and targets don’t register. Sometimes the trail doesn’t kick in when it should. I honestly don’t know why this is because it’s code that’s tried and tested on many other algos.
For the stops, you could also try:
If LongOnMarket then
SET STOP %LOSS sl
SET TARGET %PROFIT tp
Endif
If ShortOnMarket then
SET STOP %LOSS sls
SET TARGET %PROFIT tps
Endif
and delete all other stop and target code.
This will set the SL when already on market, while abraxas‘s question was why the SL was missing on entry, the very first candle.
The short side is not affected by those changes.
I meant if I should make the same changes for row 166 & 167 if using tradetype = 3 (short)?
..or use what nonetheless just posted?
Yes, I realise, but at least it should be there from the second candle, no? which is only 2 minutes
And if he wants different SL values for long and short then I can’t see how else to do it.
The modifications I suggested don’t affect short trades.
It looks strange. Which settings?
strange just did a backtest on 200k
NAS-2m-HULL-SAR-v5.5-L.itf
Its the one in the attachment list i did not change anything
Dow-2m-HULL-SAR-v5.3-Sh.itf
Did anyone got this one working: Dow-2m-HULL-SAR-V5…?