There is new information given by AB developer himself today as someone was asking similar question today. If you have AB version 6.30 and above then you may use ApplyStop new "valid from-to" settings. See here
https://forum.amibroker.com/t/time-stop-or-n-bar-stop-with-extra-condition/15776/3
So below 6.30 you have to iterate and if you have AB >= 6.30 then all you need is ApplyStop.
The example there in AB forum uses below 3% ROC since entry.
In your first post here you want to exit if ROC is below zero at nbar after entry.
So try this one (if you have AB 6.30). Change amount from 3 to low number close to zero.
I haven't tried it.
Code:Version(6.30);// code requires min. AB 6.30 Buy = MA(C, 20); BuyPrice = C; Sell = SellingCross;// regular Sell signal, choose you own one SellPrice = Close;// for regular Sell Stale = 20;// nbars after entry amount = 1e-9; // very low number close to zero see -> StaleStop = ROC(C, Stale) < 0; // For AB versions >= 6.30 // https://forum.amibroker.com/t/time-stop-or-n-bar-stop-with-extra-condition/15776/3 // this max loss is valid only on n-th bar ApplyStop( stopTypeLoss, stopModePercent, amount, True, False, 0, Stale /* valid from */, Stale /* valid to */ );
I just had AB 6.20 but I'm downloading the new update right now !
Thanks for this @trash . I appreciate it. I will hopefully have an opportunity to give it a go soon.