_SECTION_BEGIN("Plus AutoTrading");
ClientID = ParamStr("ClientId", "000000");
Symbol = ParamStr("Symbol", "NIFTY13APRFUT");
Price = NumToStr(C, 1.2, True);
Quantity = Param("Quantity", 1, 1, 100, 1);
AT = ParamToggle("AutoTrade", "No,Yes");
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([COLOR="Blue"]"X_Nest.PlusApi"[/COLOR]);
if(plus) {
plus.[COLOR="Blue"]X_Initialize[/COLOR]("TestX1");
if(Cond AND Checkdt != dt ) {
if(LastValue(Buy) OR LastValue(Cover)) {
plus.[COLOR="Blue"]X_PlaceOrde[/COLOR]r("BUY", RefNumber, "NSE", Symbol, "DAY", "LIMIT", AplliedQuantity, Price, 0, 1, "CNC", ClientID);
}
if(LastValue(Short) OR LastValue(Sell)) {
plus.[COLOR="Blue"]X_PlaceOrder[/COLOR]("SELL", RefNumber, "NSE", Symbol, "DAY", "LIMIT", AplliedQuantity, Price, 0, 1, "CNC", ClientID);
}
StaticVarSet("RefNumber",RefNumber + 1);
StaticVarSet("lastdt", dt);
}
}
}
_SECTION_END();