Algo Trading @MasterTrust

mastermind007

Well-Known Member
@mastermind,

the signscalein/sigscaleout constants are used by backtester only; while the MTv3 will require Buy/Short variables for appropriate live action.
Yes, mastertrust, you are correct in saying that sigscalein/sigscaleout constants get used by Amibroker for backtesting but you are incorrect in saying that it is getting used by "backtester only".

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.
POINT #1
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:
@mastermind,

- signscalein/sigscaleout constants are meant for backtester as per amibroker documentation. People using these constants for other purpose mess up the code in many aspects and blame the plugin

- AFL code belongs to the trader and it his discretion to use it for backtesting or live trading. Rather we encourage trader's discretion and that is why we do not advise/recommend any afl strategy at all.

- MasterTrader v3.0 follows the same logic and same convention as Amibroker does. It simply triggers orders on Buy/Sell/Short and Cover variables appropriately. The convention is NOT to use sigscalein instead of Buy

The code:
RTBuy = (LastValue( Ref(Buy,-1)) == sigScaleIn ) ....
RTShort = (LastValue( Ref(Short,-1)) == sigScaleOut) ....
does not works in may scale-in/scale-out AFLs. If you think it's robust enough, please share complete sample strategy code. We will be more than happy to service you better.

Happy Trading!
AlgoTrading@Mastertrust
Click for Inquiry
Click for Demo of MasterTrader v3.0
 
To Master trust
Sir, Do you have a plug - in where the data charts and signals are in Ninja Trader , while the trade takes place in Nest Trader of Zerodha. My mail Id: [email protected] . Pl reply regarding costs to my mail I'd. I am very much interested.
 
Weekly Tip #5 Continued from Using Renko Charts with MasterTrader v3.0, Scale-in and Exit with Net Position Check, Smart Execution and Using Multiple Time-frame for Position Sizing

Bracket Order: Simplest Automated Trading

Consider an example: Nifty is trading at Rs. 7800, but you want to buy it at a lower price of Rs. 7750. However, once it is bought, you may want to sell it at Rs. 40 target or Rs. 20 loss, whichever happens first.

This simple and common strategy is difficult to execute with plain manual trading. After submitting the initial buy order, the trader will have to keep his eyes fixed on the trading terminal. As soon as Nifty futures are bought, he needs to place BOTH the stop-loss and profit target limit order. If either or Stop Loss or Target conditions are met, he needs to immediately cancel the other leg. If he misses, there are chances of further losses by accidentally Shorting the Nifty futures.

Thankfully, all three legs of the trade can be automated quickly by Bracket Order.

Bracket Order is a three-leg order by which a trader takes position in the market and at the same time defines the Stoploss and Target for his trade. If either of Stoploss or Target order is triggered, the other exit order is canceled automatically. It is also known as an OCO order ie. One Cancels Other. Its is available in MasterSwift itself using shortcut key: Shift+F3/F4.

Happy Trading!
AlgoTrading@Mastertrust
Click for Inquiry
Click for Demo of MasterTrader v3.0
 

Attachments

To Master Trade,

I m also interest with algo (via Amibroker )and i need to take sub-broker with u (Having NISM certifcate)....Kinldy mail me the details :

1.Monthly cost of Algo (Dealer module) ?

2.My Executions need with MTv.3 or presto (Different clients for different scripts with different position size).Is it possible ?

My Mail ID :[email protected]
 
@mastermind,

- signscalein/sigscaleout constants are meant for backtester as per amibroker documentation. People using these constants for other purpose mess up the code in many aspects and blame the plugin

- AFL code belongs to the trader and it his discretion to use it for backtesting or live trading. Rather we encourage trader's discretion and that is why we do not advise/recommend any afl strategy at all.

- MasterTrader v3.0 follows the same logic and same convention as Amibroker does. It simply triggers orders on Buy/Sell/Short and Cover variables appropriately. The convention is NOT to use sigscalein instead of Buy

The code:
RTBuy = (LastValue( Ref(Buy,-1)) == sigScaleIn ) ....
RTShort = (LastValue( Ref(Short,-1)) == sigScaleOut) ....
does not works in may scale-in/scale-out AFLs. If you think it's robust enough, please share complete sample strategy code. We will be more than happy to service you better.

Happy Trading!
AlgoTrading@Mastertrust
Click for Inquiry
Click for Demo of MasterTrader v3.0
Mastertrust

Yes, it can certainly be done in AFL and I cannot see any reason in the QuantX code that would act as hindrance. If there is anything that can interfere within QuantX internals, you will need to share that.

I'll try and cook up some contrived example code that demonstrates this.
 

Blackhole

Well-Known Member
Weekly Tip #5 Continued from Using Renko Charts with MasterTrader v3.0, Scale-in and Exit with Net Position Check, Smart Execution and Using Multiple Time-frame for Position Sizing

Bracket Order: Simplest Automated Trading

Consider an example: Nifty is trading at Rs. 7800, but you want to buy it at a lower price of Rs. 7750. However, once it is bought, you may want to sell it at Rs. 40 target or Rs. 20 loss, whichever happens first.

This simple and common strategy is difficult to execute with plain manual trading. After submitting the initial buy order, the trader will have to keep his eyes fixed on the trading terminal. As soon as Nifty futures are bought, he needs to place BOTH the stop-loss and profit target limit order. If either or Stop Loss or Target conditions are met, he needs to immediately cancel the other leg. If he misses, there are chances of further losses by accidentally Shorting the Nifty futures.

Thankfully, all three legs of the trade can be automated quickly by Bracket Order.

Bracket Order is a three-leg order by which a trader takes position in the market and at the same time defines the Stoploss and Target for his trade. If either of Stoploss or Target order is triggered, the other exit order is canceled automatically. It is also known as an OCO order ie. One Cancels Other. Its is available in MasterSwift itself using shortcut key: Shift+F3/F4.

Happy Trading!
AlgoTrading@Mastertrust
Click for Inquiry
Click for Demo of MasterTrader v3.0
in this bracket orders ...what is the breakeven points for nifty 4 lots with 25 sl -target and same with banknifty(2 lots) with 60 point sl-target....

i mean plain brokerage + taxes....any advantage if one trades 2-10 trades a day.
 
@psubasri

Trying to reach you over email.

Your requirement can be deployed in both MasterTrader v3.0 and Presto. Please call us for a technical consultation to find out which is most appropriate (HelpDesk: 0120-3083333).
 
@Blackhole,

The brokerage is customizable depending upon trading volume. Please call (HelpDesk: 0120-3083333) for a custom solution for your trading requirements (manual or automated). Please also note that any additional brokerage is not charged for Bracket Order.

So your break-even point will be same- in manual or automated trading as discussed in the example.