Thank you so much for your response, I already solve that issue.
Well, I have one more issue That I have a problem with.
I read all document of IB Controller and I trying to send to IB order with TickSize of 0.1, that means 1/10, I set in my configuration the option to send such orders to IB but somehow its cancel the orders, any idea what should I do?
Thank you
TickSize - you need to note well that IBController defines TickSize differently than AmiBroker. TickSize in IBController is expressed in PIPS (0.0001 fraction), not in dollars (or whatever currency).
So 0.01 AmiBroker tick size (1 cent) is equivalent to 100 pips. If you wanted 0.1 (10 cents), then you should use 1000 (pips) in IBController.
As per IBController documentation http://www.amibroker.com/at/ TickSize - defines minimum price fluctuation allowed for given symbol expressed in pips (= 0.0001). For most US stocks it is 100 (represents 0.01 move), for most currencies: 1 (represents 0.0001 move), if minimum move is less than 0.0001 you can use fractional values for example 1/100 for 0.000001 move.
The formula that you are using may be producing inaccurate numbers and then you suffer from the fact that 0.1 is infinite fraction in binary system. However, any power of 2 is 100% accurate so 0.25, 0.125, 0.0625 would work as well
It's not about my Formula, I took it forward and trying to send the bid price, the results as you can see, My opinion is that something in the controller.
Butting in here... @Muli, you didn't write anything that we can see other than "tickSize = 0.01".
Here, I'll write it, too:
tickSize = 0.01
Now what? That line by itself is not going to get much done. I'm assuming that you actually have some .AFL code wrapping around there somewhere, yes? But how could I know?
You've got @tomasz trying to guess your code while you slowly tease out hints.
Post your code; no one is going to steal your money maker - remember that you're the one asking for assistance. /rant
hi, I have a question about the ticksize in the IBController
I always used 100 and never had a problem. I was again programming some code and thought I calculate this number exactly. In the manual it says:
"TickSize - defines minimum price fluctuation allowed for given symbol expressed in pips (= 0.0001). For most US stocks it is 100 (represents 0.01 move), for most currencies: 1 (represents 0.0001 move), if minimum move is less than 0.0001 you can use fractional values for example 1/100 for 0.000001 move."
so the TickSize I give to the PlaceOrder() and ModifyOrder() functions I calculate as follow
So for the calculation of tz I use the TickSize which is taken from the Information I put inside Amibroker for each symbol separately.
It seems to work but for NG futures it does not work. The TickSize for NG futures is 0.001. Therefor tz will result in the number 10 which then is used in PlaceOrder and ModifyOrder. Then the order will not be sent. Only when I change it back to 100 the order for NG futures is sent.
i can only say that if I use the correct value for NG, which is 10 and for instance for GC and PL futures it is 1000, it doesnt work. If I use 100 for all then it works
i just removed the Ticksize entirely from the PlaceOrder and ModifyOrder functions and this also works. Good enough for me. I am not sure if I need it and it works without it. Please correct me if I am wrong
if I just omit the ticksize as a parameter then it works also for EUR.USD-IDEALPRO-CASH
this is the only 1 I tested. I am not really familiar with forex trading
but I now just use code like this:
// retrieve orderID from previous run, will be empty if no order was placed before
OrderID = StaticVarGetText( "OrderID" + cidi );
//_TRACE("OrderID: " + OrderID);
//_TRACE("Pending: " + ibc.IsOrderPending(OrderID));
// place order
if( ibc.IsOrderPending( OrderID ) )
{
OrderID = ibc.ModifyOrder( OrderID, symb, "BUY", nos, orderType, ask_price, 0, "Day", transmitOnOffFlag );//, tz );
}
else
{
OrderID = ibc.PlaceOrder( symb, "BUY", nos, orderType, ask_price, 0, "Day", transmitOnOffFlag );//, tz );
}
// store orderID for next run so we know which order to modify
StaticVarSetText( "OrderID" + cidi, OrderID );
as you see the ticksize is tz and I commented it out. I now do not use it at all. Please let me know if there is a problem with this. I am not sure what it is used for. But if I leave it out it seems to work fine.
as I tested it many times when you take out the ticksize it send the order as ticksize = 100,for some instruments like forex or future like HG HO RB it will not work
ok yes ofcourse when omitted the number 100 is used, I forgot. Well it is strange indeed since I need to use the number 100 for all the futures I tested, CL, NG, PL, GC, SI, ES while the actual numbers that need to be used according to the instructions should be 100, 10, 1000, 1000, 50, 2500. But the only number that works is 100 for all these futures. I do not understand it but it works
Will try to figure out how it works