SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Oct 19, 2020 6:19 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Dec 31, 2007 9:21 pm 
Offline

Joined: Tue Oct 23, 2007 11:47 pm
Posts: 154
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();


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group