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 – Button Style Manual Trading Control for NEST/NOW

1 min read

Here is a simple Button Style Trading Control’s in Amibroker (Extracted from Wisestocktrader : Credit goes to the creator ranjicgnr). The Creator had added button style manual trading control to place One-Click Trading from Amibroker Charts. He had desinged the framework for sending manual click button trading from Amibroker to NEST/NOW trading terminals using Nest Plus Plugin.(Requires Nest Plus Plugin Subscription from Omnesys).

Manual Button Trading

[wp_ad_camp_5]

 
So looking at the charts and taking a manual decision and then using the trading terminals to place orders are cumbersome and involves lot of delay in the process. Manual button based trading solves the delay by trading from Amibroker Charts. The User Interface and the User Experience is cool. IF you are a amibroker user it is a must to try out. If you are very new to Automated trading then start with the tutorial Understanding Autotrading in NSE Future markets

Features

You can predefine your quantity of Buy/Sell in the parameters
You Can Enter your Client ID in the Parameters
You can select the Buy/Sell Price from Ask price, Bid price or LTP.
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.
Selecting the Buy/Sell as Intraday or Delivery.

Requirements

For Buy/Sell Price selection, use Aux1 and Aux2 for importing the Ask Bid Prices.
Symbol in the Amibroker should be the same as present in the NEST/NOW.
Active Nest Plus API Subscription is required (Contact Nest Plus for Details)

Usage
Copy The Afl to Custom Afl folder of amibroker.
Drag and drop the afl to an intraday chart blank chart.
Enable Controls and Auto Trading Options.
Set Lot Qty and Purchase Type.
Type the Client ID.
Press Buy Or Sell when you decided.
(Decisions should be based on your trading strategy. This Afl will not generate any Buy/Sell Signals automatically)
[Suggest Features For Improvement] [NEST, NOW, Amibroker are registered products of the Respective Companies]

The Following code is tested in Amibroker 5.8 and 5.9 version

https://gist.github.com/1f2f58bb8976a07ed1fc

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

32 Replies to “Amibroker – Button Style Manual Trading Control for NEST/NOW”

  1. This is the error message i am getting with amibroker 5.6 version any solution for this

    Auto trade :
    StaticVarSet(“LTQSave”, LTQLastTemp, 1);
    StaticVarSet(“VolumeTemp”, VolumeLastTemp, 1);
    StaticVarSet(“AskSave”, AskLastTemp, 1);
    StaticVarSet(“BidSave”, BidLastTemp, 1
    ————————————-^
    File: ‘Formulas\Drag-drop\Auto trade 3.afl’, Ln: 129, Col: 38
    Error 16.
    Too many arguments
    Use ‘Edit Formula’ to correct error”

    thanks sir

  2. Dear sir

    I don’t know what to say, what your doing is splendid job for the traders like me, without anything in return.

    Information is wealth, your just giving it like anything–pure selfless

    Thanks a lot

    1. Tested in 5.8 and 5.9 and worked fine. May be the code uses some new functions which is not compatible with 5.6 and 5.7 will try to figure it out.

  3. I am facing error too many arguments

    StaticVarSet(“LTQSave”, LTQLastTemp, 1);

    How to rectify it

    1. Probably you are using Amibroker version less than 5.8. Currently the code is compatible with 5.8 and above. Kindly try upgrading your amibroker version and check it out.

  4. i have copy your AFL & run in Amibroker 5.9. it shows Buy Sell button. but i want to know can we use it with any broker or particular broker required to use auto buy sell pls. suggest

    1. 1)You need a Nest/Now Trading Terminal most of the discount brokers these days provides you can also use yourbroker tool to find out which are the brokers providing

      2)You need to have Nest API subscription (Rs250/- month) from Omnesys and a Nest Plus Trading Terminal download

      3)Now you can place semiautomatic trading from Amibroker to Nest Trading Terminal.

  5. dear sir,

    how can i join your amibroker course ? kindly reply

    regards
    maninder singh

  6. Hi!!

    Can you please tell where can I subscribe for the Nest Plus Plugin for NOW? I have contacted Omnesys (which have been overtook by thomas reuters) and they have told me that the plus api is only available on nest trader terminal and can be bought only via broker. Please help me in this regards.

    Thanks in advance!!

  7. Sir,
    I have following observations:-
    a) Does this needs to be dragged & dropped on any Strategy AFL or Strategy needs to be typed into it?
    b) When BUY/ SELL Button is punched, symbol error comes in NEST Trader, as symbols text in NEST Trader is different from those in AMIBROKER. Please advise its remedy?
    c) Any change in codes required to make it to puch orders AUTOMATICALLY?
    Thanks & Regards.

    1. The first requirement is you need Nest API to be enabled. Check with your broker to do that. Then you have to drag and drop to your own startegy.

  8. Thanks Raj Sir,

    My query remain, half answered:
    a) The NEST Api is activated by ZERODHA (my broker);
    b) The AMIBROKER Symbol is NIFTY-I, but NEST Trader has NIFTY14JANFUT , so there is incompatibility in names. How to Address it, when orders goes in NEST Trader.?
    c) Can it be made to punch orders automatically?

    Please advise.

  9. Raj Sir,
    Can u please advise on this KAKA’s AFL. (credit of these goes to KAKA ji);

    Though, the NEST Plus API is activated. Somehow, I see that orders is not going into NEST Trader.

    ClientID = ParamStr(“ClientId”,”ID”);
    Symbol= ParamStr(“Symbol”,”NIFTY14JANFUT”);
    Slp= Param(“Slippage%”, 0.05);
    Bprice= NumToStr(Ref(H,-1)*(1+slp/100),8.3,True);
    Sprice= NumToStr(Ref(L,-1)*(1-slp/100),8.3,True);
    Quantity=Param(“Quantity”,1,1,100,1);
    OE = ParamList(“Order Execution”,”Immediate,On Candle Completion”,1);
    AT = ParamToggle(“AutoTrade”,”No,Yes”);

    if(OE==”On Candle Completion”)
    {
    Buy=Ref(Buy,-1);
    Short=Ref(Short,-1);
    Sell=Ref(Sell,-1);
    Cover=Ref(Cover,-1);
    }

    AplliedQuantity=IIf(LastValue(Buy) AND LastValue(Cover) OR LastValue(Short) AND LastValue(Sell),Quantity*2,Quantity);
    RefNumber = Nz(StaticVarGet(“RefNumber”));
    Checkdt=Nz(StaticVarGet(“lastdt”));
    dt = LastValue( DateTime() );
    Cond=LastValue(Buy) OR LastValue(Short) OR LastValue(Sell) OR LastValue(Cover);

    if(AT)
    {
    plus = CreateStaticObject(“Nest.PlusApi”);
    if(plus)
    {
    plus.SetObjectName(ClientID);
    if(Cond AND Checkdt != dt )
    {
    if(LastValue(Buy) OR LastValue(Cover)){plus.PlaceOrder(“BUY”,RefNumber, “NFO”,Symbol,”DAY”,”LIMIT”,AplliedQuantity,BPrice, 0,1,”NRML”,ClientID);}
    if(LastValue(Short) OR LastValue(Sell)){plus.PlaceOrder(“SELL”,RefNumber, “NFO”,Symbol,”DAY”,”LIMIT”,AplliedQuantity,SPrice, 0,1,”NRML”,ClientID);}
    StaticVarSet(“RefNumber”,RefNumber+1);
    StaticVarSet(“lastdt”,dt );
    }
    }
    }

  10. Try this:

    Delete “, 1” and make sure to correct all below lines look like this:

    Auto trade :
    StaticVarSet(“LTQSave”, LTQLastTemp);
    StaticVarSet(“VolumeTemp”, VolumeLastTemp);
    StaticVarSet(“AskSave”, AskLastTemp);
    StaticVarSet(“BidSave”, BidLastTemp);

    1. When comes to Autotrading only Limit Order is supported for Retail Traders and MKT/LMT for Dealers. Cover Order and Bracker Order are just manual trading features.

  11. Dear Sir,
    & Also Mr Kiran,
    Can you please amend it so that Orders are Pucnched Automatocally into NEST and SELL & COVER be also supported.
    I could not place your suggestions for AUTO TRADE into it.
    ClientID = ParamStr(“ClientId”,”ID”);
    Symbol= ParamStr(“Symbol”,”NIFTY14JANFUT”);
    Slp= Param(“Slippage%”, 0.05);
    Bprice= NumToStr(Ref(H,-1)*(1+slp/100),8.3,True);
    Sprice= NumToStr(Ref(L,-1)*(1-slp/100),8.3,True);
    Quantity=Param(“Quantity”,1,1,100,1);
    OE = ParamList(“Order Execution”,”Immediate,On Candle Completion”,1);
    AT = ParamToggle(“AutoTrade”,”No,Yes”);

    if(OE==”On Candle Completion”)
    {
    Buy=Ref(Buy,-1);
    Short=Ref(Short,-1);
    Sell=Ref(Sell,-1);
    Cover=Ref(Cover,-1);
    }

    AplliedQuantity=IIf(LastValue(Buy) AND LastValue(Cover) OR LastValue(Short) AND LastValue(Sell),Quantity*2,Quantity);
    RefNumber = Nz(StaticVarGet(“RefNumber”));
    Checkdt=Nz(StaticVarGet(“lastdt”));
    dt = LastValue( DateTime() );
    Cond=LastValue(Buy) OR LastValue(Short) OR LastValue(Sell) OR LastValue(Cover);

    if(AT)
    {
    plus = CreateStaticObject(“Nest.PlusApi”);
    if(plus)
    {
    plus.SetObjectName(ClientID);
    if(Cond AND Checkdt != dt )
    {
    if(LastValue(Buy) OR LastValue(Cover)){plus.PlaceOrder(“BUY”,RefNumber, “NFO”,Symbol,”DAY”,”LIMIT”,AplliedQuantity,BPrice, 0,1,”NRML”,ClientID);}
    if(LastValue(Short) OR LastValue(Sell)){plus.PlaceOrder(“SELL”,RefNumber, “NFO”,Symbol,”DAY”,”LIMIT”,AplliedQuantity,SPrice, 0,1,”NRML”,ClientID);}
    StaticVarSet(“RefNumber”,RefNumber+1);
    StaticVarSet(“lastdt”,dt );
    }
    }
    }

  12. i wan to punch an automatic order when ever a signal come in my afl but at lower close value
    ..like i am trading banknifty option for strikeprice XXXXX @ Rs 55 . Signal come at Rs 55 but order should be placed for Rs 50 .

    can it be done?

    What afl code i need to put in my afl

  13. I get error on the line : nestplus.SetObjectName(“MaualTradingInt”);
    Error 19: COM method/function ‘SetObjectName’ call failed. COM Error: COM Error: HRResult = 80010105

    Nest plus is initialized well. Seems some problem with the above method.

    Please help what should be done to resolve.

Leave a Reply

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