Home › Forums › Trading System Mentor Course Community › AmiBroker Coding and AFL › Rotational Systems
- This topic is empty.
-
AuthorPosts
-
September 6, 2017 at 4:18 am #101698Stephen JamesMember
Below is some notes on rotational systems that I’ve recently added to my templates.
/*
Notes for Rotational systems.
1. Use Pad & Align (General tab in analyser settings) for back testing (not daily operation).
– Ensure the index chosen has full data history for the test period.
– Without Pad & Align there will be problems if the first symbol in the watchlist tested does not have full data history for the test period.
2. Buy and Sell Price are set in the analyser settings (Trades tab). They are not coded.
3. Rotation is governed by PositionScore. There are no Buy and Sell variables used.
– Therefore there are no buy and sell signals to plot on a chart.
– Entry criteria can be used to govern when to rotate.
– There are no separate exit criteria although the ApplyStop function or Stops in the analyser settings can be used.
4. Negative values for PositionScore (ranking) will initiate short trades.
5. There is no selection bias so MCS code is not required.
6. Code to prevent entry into delisted stocks should be used. Exit code for delisted stocks is not needed.
7. Run the system with anaylser Periodicity setting on ‘Daily’. Code will determine when to rotate (monthly, weekly etc).
8. Search ‘Amibroker rotational trading’ for more information.
*/September 6, 2017 at 6:41 am #107618AnonymousInactiveThanks Craig. Did something change in Amibroker? I wasn’t using pad & align previously and I did not have any problems. Today I checked in to see if my backtest matched my trades for September and I had no trades for September in my backtest, added pad & align as per this thread, and then the trades populated in the backtest.
Also, is there anything specific we should know about the “reference symbol” that we use other than that it should have full data history for the test period? E.g. could I use $spx for an AU backtest? Thanks.
September 6, 2017 at 6:55 am #107620AnonymousInactiveAlso, should we be using Pad & Align for non-rotational backtesting? Thanks.
September 6, 2017 at 8:45 am #107621LeeDanelloParticipantI think u use it for any system that reference the foreign function. If use an index filter that uses a 200MA and the ticker has less than 200 bars there will be null values for the index filter and you won’t get a trade.
September 6, 2017 at 10:32 pm #107622Stephen JamesMemberAB have recommended using P&A for rotational systems due to the way the ranking is processed in regard to the first symbol in the watchlist being tested. It will give erroneous results if that symbol does not have full data history for the test period. This was a recent development after noticing a small number of trades being held past rotation dates when testing certain watchlists.
You can use any symbol for P&A so long as it has full data history, but I’d suggest it needs to make sense for your system and universe being tested.
Do not use P&A for other systems. It can skew some indicators.
September 7, 2017 at 7:53 am #107625JulianCohenParticipantCan you hard code P&A so that you don’t need to remember to turn it on and off?
September 7, 2017 at 10:48 pm #107629Stephen JamesMemberNo that I’m aware of or could find Julian.
I’ve emailed AB as it would be helpful. Will let you know their response if it is anything besides ‘no’.September 8, 2017 at 3:02 am #107619RobGilesMemberI’m struggling with the following piece of code in my momentum / rotational system:
//Regression Slope
//================================================================================
RGLB = Param(“Regression Lookback”,90,10,500,1);
LogOfPrice = ln(C);
ExponentialSlope = LinRegSlope(LogOfPrice,RGLB);
AnnualizedSlope = 100 * ((exp(ExponentialSlope))^250-1);Re the last line:
AnnualizedSlope = 100 * ((exp(ExponentialSlope))^250-1);
what is the “exp” function doing? According to Clenow’s book he says something to the effect of “to arrive at an annualised return we need to convert the slope back by applying the EXP() fn…now annualise that by raising it to the power of 250 trading days”, but I don’t understand why we have to “convert the slope back”. I also don’t understand why the template code has it raised to the power of 250-1. Can anyone shed some light on this please?
September 8, 2017 at 10:26 pm #107639Stephen JamesMemberResponse from AB, Julian:-
No, you can’t code that, but you can save your Analysis project (File->Save As…)
instead of just saving formula.
Analysis project contains ALL settings AND formula in one file.Save as an apx file.
Craig
September 9, 2017 at 8:36 am #107640JulianCohenParticipantCraig Fisher wrote:Response from AB, Julian:-No, you can’t code that, but you can save your Analysis project (File->Save As…)
instead of just saving formula.
Analysis project contains ALL settings AND formula in one file.Save as an apx file.
Craig
Ah that is very useful. That means we can save an analysis template with brokerage set for Aud or Usd which is something I always found a pain having to change around.
Thanks for that!
-
AuthorPosts
- You must be logged in to reply to this topic.