<div dir="ltr">Good morning,<div><br></div><div>I'm trying to rebuild the basic strategy out of Andreas Clenow's book "Following the trend in quantstrat but struggling with the trailing stop. The rules are as follows (only for long trades):</div><div><br></div><div><p><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">1.</span><span lang="EN-GB" style="font-size:7pt">     </span><b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">Entry rule</span></b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">: Buy open tomorrow
when close is higher or equal to the highest close of the past 50 days</span></p>

<p><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">2<b>.</b></span><b><span lang="EN-GB" style="font-size:7pt">     </span></b><b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">Filter</span></b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">: Long entries only if SMA50
>= SMA100</span></p>

<p><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">3.</span><span lang="EN-GB" style="font-size:7pt">     </span><b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">Closing</span></b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">: Sell open tomorrow when
breakout to the downside or SMA50 < SMA100</span></p>

<p><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">4.</span><span lang="EN-GB" style="font-size:7pt">     </span><b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">Trailing stop (and this seems to be the difficult one)</span></b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">: Sell open tomorrow when close price is lower than highest high since
deal entry minus 3 times the current ATR (100days) - current ATR and not the
ATR at deal entry</span></p>

<p><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">5.</span><span lang="EN-GB" style="font-size:7pt">     </span><b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">Position sizing</span></b><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">: Risking always a
fixed amount</span></p><p><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">I read about the idea of just adding an indicator which is triggering the stop but the problem is that this indicator has to depend on the entry dates of the strategy. My idea was to alter the indicator in the mktdata object every time I enter a trade via the ordersizing function osFUN. But this didn't work.</span></p><p><span lang="EN-GB" style="font-size:10pt;font-family:Arial,sans-serif">Does anyone have a solution for this problem?</span></p><p>Kind regards,</p><p>Ingo</p></div></div>