inputs:
size(1);
variables:
marktpos(0),
OrderID ("");
marktpos =NTMarketPosition("AB1234");
if marktpos=0 then begin
OrderID ="EnterShort";
value1 =NTSellMarket(OrderId,size);
end;
if marktpos=1 then begin
OrderID ="EnterShort";
value1 =NTSellMarket(OrderId,2);
end;
if marktpos=-1 then begin
OrderID ="ReverseShort";
value1 =NTBuyMarket(OrderId,2);
end;
I have the indicator set to update at end of bar, not every tick. It is supposed to just test the interface by entering short first then reversing at the close of every bar. When I deploy it, it sends off a zillion orders about a second apart, all short with quantity =1. I wind up with lots of contracts in my simulation account and programs not responding.. I have another indicator plotting marketposition and it never gets the position, it reads "0" all the time so it appears that the above code never updates the marketpostion and it also sends off orders intrabar when it should only send them at the end of the bar.
Comment