Question about Stop losses in different time frames

Hello everyone,

I am testing a monthly rotational strategy with the following code:


SetBacktestMode(Backtestrotational); 
SetOption("initialequity", 100000); 
SetOption("Maxopenpositions",4);
SetPositionSize( 25, spsPercentOfEquity );





Score= ((ROC(Close, 8) + ROC(Close, 10)) + ROC(Close, 12))/ 3 ;


Positionscore= Score+1000;

BuyPrice= Close;

ApplyStop(stopTypeTrailing,stopModePercent, Optimize("stoploss", 10,1,30,1));

I want to add a stop loss but I am concerned since I am using monthly bars during the test that the stop loss will not be accurate . The trailing stop loss would need to be updated daily while the test is using monthly bars. I did some research on time frame expand function but I was not able to figure out how to program that into the stop loss. Thank you again for any help/ feedback you can give!

I don't believe you can use stops when running in Rotational Mode. See this post: Apply Stop in Rotational Backtest

You could rewrite your strategy to act like a rotational strategy without using AmiBroker's built-in rotational mode, but you would need to run on daily bars if you want the trailing stop to trail daily prices.

4 Likes

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.