Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

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

 
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 Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

What is QuantZilla?

Quantzilla is 75+ hours of code mentoring program designed for noncoders who want to learn the coding program right from designing indicators, scanners, trading...
Rajandran R
58 sec read

Things to Consider While Building a Bracket Order Execution…

Building a Bracket Order Strategy is the most demanded request we got from most of the algomojo traders. This article explains the list of...
Rajandran R
12 min read

PlaceOrder – Multi Broker Exectuion Code Snippets for Amibroker

This tutorial explains how to build a button trading right from scratch and with a click of a button how you can send orders...
Rajandran R
7 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. 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.

  3. 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.

  4. 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!!

  5. 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.

  6. 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.

  7. 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 );
    }
    }
    }

  8. 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.

  9. 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 );
    }
    }
    }

  10. 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

  11. 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 to Rajandran R Cancel reply

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