@mastermind,
the signscalein/sigscaleout constants are used by backtester only; while the MTv3 will require Buy/Short variables for appropriate live action.
the signscalein/sigscaleout constants are used by backtester only; while the MTv3 will require Buy/Short variables for appropriate live action.
Decision of confining usage of those constants to backtesting only was the limitation imposed by Master Trust's Algo programming team and IMHO, this imposition is inappropriate for following reasons:
Can you tell me one good reason why anyone wanting to implement scaling in/scaling out strategy not want to get it back tested before running it in ALGO mode?
Assuming that you cannot find any good reason not to back test any strategy, why would you create algo trading interface that requires different approach than the de-facto standard created by Amibroker for implementing scaling in/scaling out?
If your algo engine follows the same logic and same convention as Amibroker does, any correctly written strategy that back tests correctly will also scale in and scale out correctly with your robo without any extra code wizardry.
One of the good approach in afl programming to implement this is:
- Run a loop on all bars
- Assign true values to Buy/Short on bars where you want to trigger buy/sell orders (buy/short should be false everywhere else)
- Keep a track of quantity by using counters in this loop
- use ATS4way for integratrion
Hope these guidelines clarify. You are welcome for any specific query.
- Run a loop on all bars
- Assign true values to Buy/Short on bars where you want to trigger buy/sell orders (buy/short should be false everywhere else)
- Keep a track of quantity by using counters in this loop
- use ATS4way for integratrion
Hope these guidelines clarify. You are welcome for any specific query.
Yes, Tip #1 is generally the practical approach but whether or not to use loop depends on the complexity of the strategy and skill of the AFL programmer.
POINT #2
Numeric value of sigScaleIn is 99998 and that of sigScaleOut is 99999;
Buy/Sell/Short/Cover arrays are floats. All assignments to these arrays, except null and non-zero, will be treated as boolean true.
Amibroker too requires that AFL assign the sigscalein/sigscaleout values to the Buy/Short arrays. Kindly check the amibroker documentation on how and where the sigscalein/sigscaleout variables are meant to be used.
POINT #4
Further, the ATS4way AFL shipped by mastertrust too can be modified as follows to implement the scalein/scaleout requirements ...
Code:
RTBuy = (LastValue( Ref(Buy,-1))[U][B] == sigScaleIn [/B][/U]) ....
RTShort = (LastValue( Ref(Short,-1))[B][U] == sigScaleOut[/U][/B]) ....
Last edited: