meaning of lines..
Hi
I have a paid subscription of Nest Plus API. The below code is not placing order in Nest or NOW platform. It does the charting and there are no error messages in Nest, NOW or Amibroker, if signal gets generated by Amibroker.. Can someone please guide me as to what is wrong with that..
Hi
I have a paid subscription of Nest Plus API. The below code is not placing order in Nest or NOW platform. It does the charting and there are no error messages in Nest, NOW or Amibroker, if signal gets generated by Amibroker.. Can someone please guide me as to what is wrong with that..
Code:
p1 = Param("TL 1 Periods", 20, 5, 50, 1);
p2 = Param("TL 2 Periods", 5, 3, 25, 1);
TL1 = LinearReg(C, p1);
TL2 = EMA(TL1, p2);
Col1 = IIf(TL1 > TL2, ParamColor("TL Up Colour", colorGold), ParamColor("TL Dn Colour", colorBlue));
Plot(TL1, "TL 1", Col1, styleLine|styleThick);
Plot(TL2, "TL 2", Col1, styleLine|styleThick);
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ))));
Plot(C, "Close", colorWhite, styleCandle);
ClientID = ParamStr("ClientId","ABC123");
Symbol = ParamStr("Symbol","SBIN");
Price = NumToStr(C,8.2,True);
Quantity = Param("Quantity",10,10,90,1);
OE = ParamList("Order Execution","Immediate,On Candle Completion",1);
AT = ParamToggle("AutoTrade","No,Yes");
Buy = Cover = TL1 > TL2;
Sell = Short = TL2 > TL1;
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,Price,0,1,"NRML",ClientID);}
if(LastValue(Short) OR LastValue(Sell)){plus.PlaceOrder("SELL",RefNumber,"NFO",Symbol,"DAY","LIMIT",AplliedQuantity,Price,0,1,"NRML",ClientID);}
StaticVarSet("RefNumber",RefNumber+1);
StaticVarSet("lastdt",dt );
}
}
}
Last edited: