Problem with Ami 4.9 + IBC

#1
Hello to all :)
This is my first time that write here.
I have a problem with a trial version of Amibroker 4.9 + IBC 1.1.1.

I am trying to place an order of stop when this close is greater than the previous close. When I write this in formula editor the IBC place the order but place this order and another and another more.

This is the code :

PC = LastValue (Ref(HHV(High,20),-1));

Buy = Ref(C,-1)> Ref(C,-2);

if( LastValue( Buy ) )
{ ibc = GetTradingInterface("IB");
if( ibc.GetPositionSize(Name()) == 0 )
{
ibc.placeOrder(Name(), "Buy", 1, "STP", 0, PC , "Day", True);
}
}

I was trying to solve this whit getpendinglist but I had the same problem.
My question is : there are some way of to solve this problem ?.
I am wraiting frome Spain and here very people has the same problem with the stop orders.

Very thanks for read me.
 

Similar threads