|
this may be helpful to the newtimers and I ran into this problem and spent a good couple of hours trying to figure out.
example.
double x, factor;
factor = 0.99;
x = bar.Close * factor;
// trying to buy 100 shares at price x
buyOrder = BuyLimitOrder(100, x);
buyOrder.Send();
This will not work on IB, because x now has a value that is not 2 decimal places long you need to chop x down to 2 decimal places. This can be done by Math.Round(x, 2);
This works:
factor = 0.99;
x = bar.Close * factor;
x = Math.Round(x, 2);
buyOrder = BuyLimitOrder(100, x);
buyOrder.Send();
|