Hi. Can anyone help? I am backtesting a system which uses Buy,Sell,Short,Cover 
variables,(TradeDelays,0,0,0,0) on close, and also stopTypeProfit(8.25%) and 
stopTypeTrailing(5.25%). The problem that I am having is in backtesting. One of 
the trades is a long position on the close, at $45.00, the following bar opens 
lower at 43.9353, and is closed out immediately (Long trail). Resulting in a 
loss of -2.37% The price then climbs to reach the profit target, but it's 
already closed. I set the trailing stop at 5.25% so shouldn't the trailingstop 
set itself at 5.25% below the entry price, and then trail, which is what I want 
it to do. 
Here is a snippet of my code,

Buy = Cross(FStRSISm,ForeignStochRSI) AND Permit; //Permit=Filter     
Sell = Cross(ForeignStochRSI,FStRSISm); 
Short = Cross(ForeignStochRSI,FStRSISm) AND (NOT Permit);
Cover = Cross(FStRSISm,ForeignStochRSI);

ProfStop = 8.25;  
TrailStop = 5.25; 
ApplyStop(stopTypeProfit,stopModePercent,ProfStop);
ApplyStop(stopTypeTrailing,stopModePercent,TrailStop); 

The system itself, does not generate any exit signals or opposite entry signals 
which could also close the trade. Therefore I can only assume that I am missing 
something in the code or settings, for the trailing stop.

Many thanks for any help, Chris.

Reply via email to