Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in)

Amibroker – Auto Trading Control for NEST/NOW Terminal

1 min read

This is the updation of Manual Trade Control for NEST/NOW. This afl have new features like it will have all the trades in its memory. This AFL is not a strategy for trading. It can be used only for integrating the Amibroker to pass orders to NEST/NOW Trading Terminal through NEST PLUS API.

Nifty Auto Trade

[wp_ad_camp_5]

 
AFL Code Written Buy : Ranjith K R
AFL Creator Email ID : [email protected]

Features

1. You can predefine your quantity of Buy/Sell in the parameters
2. You Can Enter your Client ID in the Parameters
3. You can select the Buy/Sell Price from Ask price, Bid price or LTP.
4. Option for Enabling Actual Trading (If Disabled, No Signals will go to NOW/NEST, But chart will generate signals.) This can be used for testing.
5. Selecting the Buy/Sell as Intraday or Delivery.
6. Selecting Order Type as Limit/ market
7. Short/Cover is included. You can add strategy and manual trade also is possible.
8. It saves all Buy/Sell & Short/Cover trades in memory and plotted until its cleared.
9. Option for selecting type of trade. ie Long,Short or Together. Long trade will only starts with a buy signal and Short Trade will Only start with Short Signal. Sell and Cover signals will only appear after buy and short signals.
10. Separate display for Buy, Sell, Short and Cover Traders for clarity.
11. KeyBoard Shortcut for Buttons.
Buy → Numpad 7
Sell → Numpad 8
Short → Numpad 4
Cover → Numpad 5
Clear → Numpad 0

Amibroker AFL Code

https://gist.github.com/bcceee7e23c8d2e67748

You have to replace the existing buy/sell strategy with your buy/sell strategy. Strictly do not use the buy/sell strategy in this afl for real trading.. Replace the following coding in the above AFL with your own Trading System

https://gist.github.com/179bc05fe0bd151f2b37

Requirements

1. For Buy/Sell Price selection, use Aux1 and Aux2 for importing the Ask Bid Prices.
2. Symbol in the Amibroker should be the same as present in the NEST/NOW.
3. Active Nest Plus API Subscription is required (Contact your broker for NEST PLUS API subscription)
4. NEST/NOW trader should be opened and logged in. Also logged in to the NEST PLUS with a valid API subscription.

Usage
1. Copy The Afl to Custom Afl folder of amibroker.
2. OPEN AFL IN FORMULA EDITED AND DELETE STRATEGY PORTION OF CODE AND TYPE PASTE YOUR BUY/SELL STRATEGY IN THAT PLACE AND SAVE THE AFL.
2. Drag and drop the afl to an intraday chart blank chart.
3. Enable Controls and Strategy and Autotrade options.
4. Select type of trades you want (Long/Short)
5. Select Buy Price, Sell Price, Product Type and Order Type
6. Enter Client ID and LotQty.

Press Buy/Sell/Short/Cover buttons for manual trading.
Strategy based signals will come automatically.

Note: Only Buy and Short will happen first. You cannot do a Sell or Cover in first. Only Two BUY or SELL or SHORT or COVER one after another are not possible.
Note: Don’t use this afl for backtesting your strategy. BackTest your strategy separately and paste it in this afl.

[Suggest Features For Improvement. This Afl is tested with amibroker 5.7 and 5.9 veraions] [NEST, NOW, Amibroker are registered products of the Respective Companies]

Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in)

[Live Coding Webinar] Build Your First Trading Bridge for…

In this course, you will be learning to build your own trading bridge using Python. This 60-minute session is perfect for traders, Python enthusiasts,...
Rajandran R
1 min read

[Webinar] Understanding and Mitigating Curve Fitting in System Trading

"Understanding and Mitigating Curve Fitting in System Trading"! This dynamic session aims to equip novice to intermediate traders, quantitative analysts, and financial engineers with...
Rajandran R
1 min read

P-Signal Strategy Long Only Strategy – Amibroker AFL Code

This tutorial provides an overview of the P-Signal reversal strategy, a quantitative trading strategy that utilizes statistical parameters and error functions to generate probabilistic...
Rajandran R
2 min read

30 Replies to “Amibroker – Auto Trading Control for NEST/NOW Terminal”

    1. Sir, please let me know if it is possible. Or please point me to any document which provides codes. The document on Omnesys site only provides for Normal Orders.

      Thanks

      1. To my knowledge for Retail Traders only Limit Orders are supported in Nest/Now. And only a dealers using dealers terminal can do Market Orders, Order Modification which is restricted as of now in common retail traders terminals due to Exchange and SEBI compliance.

  1. sir i am using now terminal only. i dont have nest or nest plus. is it working now terminal? pls reply.

  2. dear,
    how to use AUX1 and AUX2 fields from AFL?
    if you make a video about it, it’s really helpful….

    1. I dont have any idea about that. If they are providing full autotrading to retail traders without NSE approval then probably it could be a illegal product.

      1. dear raj,

        how to write in afl, BUY at signal price AT CL basis of Candle stick of 5 Min with order type “lIMIT” , becoz my order will be generated on the base of particular signal of an indicator, i m not going with order type MARKET, due to slippage factor, my holding will be basically more than 30 mins to 2 hrs.

        plz advise………………

  3. i have a strategy which works fine on 2 min candlestick closing price.
    if the price is moved above the 0.8% of opening price of the first 2 min candle stick then buy and target being 1.6% of the opening price of the first candle stick. If it reaches then exit else continue.
    StopLoss being Opening price.

    ex : opening price of 1st candle stick is 100 at 9:16 and at 9:18 or whenever the price reaches 100.8 i will buy and selling it when the price reaches to 101.6
    StopLoss is being if price moves below 100

    1. How can you coded this?
    2. how to check the status of the trade executed ?

  4. Dear Mr. Rajandran,
    I’m having a very little knowledge on AmiBroker and Chart Analysis. But i’d like to go for Semi-automated AlgoTrading with Amibroker. So, Can you help me with a most effective and accurate Buy/Sell signal generating AFL which will work on AlgoTrading with Amibroker. And what is the role of NEST Plus in Algo, what does it do??

    If you want to share/discuss anything in private feel free to drop a mail at your convenience on the above mentioned email-id.

  5. If I try to use this afl alog with sort of supertrend, its not working, I mean it is not generating signals..
    The code is Buy = trend==1; where trend is derived as from supertrend indicator.Pls help…

  6. Hi,
    Anyone got this working for NFO kindly post the modified code. Keep getting error ‘COM object variable is not initialized or has invalid type(valid COM object handle is required)’. Using Trial ami 5.9, and GDFl datafeed , Tried reinstallation of ami, as suggested by someone else in the forum with no luck. Strangely the GDFL plugin works fine.
    Thanks in advance

  7. IS this settings working in Nestnow terminal, I mean have anyone tested this with some live AFL. I just need confirmation so as I may subscribe to nestnow API and test also

  8. Does anyone recently got NEST Plus activated for NSE Now Terminal? I am trading using NSE NOW terminal from Zerodha and not able to get NEST Plus activation.

    Do you suggest any alternate API?

  9. Dear Team,

    I didn’t understand below mentioned lines…can you please explain me same in easy language. so i can understand.

    Note: Only Buy and Short will happen first. You cannot do a Sell or Cover in first. Only Two BUY or SELL or SHORT or COVER one after another are not possible.

  10. how to set trading time
    eg.from 9.30am to 3.00 pm
    here can u provide those code so that i can set trading time also

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More