SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Dec 10, 2019 12:08 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Fri Feb 22, 2008 5:15 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
Also, why don't you use trades instead of one second bars? You can create a time series, create SMA using this series as input and add trade.Price to input series in OnTrade. I believe the result will be the same but you will have more control and less errors.

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 5:21 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
Hi Anton,
thanks for your fast reply. It is indeed not a definite OQ Bug, but since we've expected the ClosePosition() method to work as it implies (closing the open position fully, thus waiting for the order to be filled, and not just sending a market order...) one can interpret this behaviour as OQ bug.
Just my 2 cents :-)

regars,
h.m.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 5:43 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
ClosePosition is just a helper function that sends a market order in opposite direction to your current position with Position.Qty... no magic...


Top
 Profile  
 
PostPosted: Mon Apr 18, 2011 7:50 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Anton,

I've been following you assistance on this thread and with to utilize your advice as quoted from above:

"create SMA using this series as input and add trade.Price to input series in OnTrade."

I gather here you're referencing a SimpleMovingAverage.
Could you show a quick code example of the best way to trade.Price to the input series in OnTrade.

Thanks,
Eric


Top
 Profile  
 
PostPosted: Mon Apr 18, 2011 8:39 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
Something like this:

Code:
TimeSeries input;
SMA sma;

OnStrategyStart()
{
  input = new TimeSeries();
  sma = new SMA(input, 14);
}

OnTrade(Trade trade)
{
  input.Add(trade.DateTime, trade.Price);
}


Top
 Profile  
 
PostPosted: Mon Apr 18, 2011 9:13 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
That's great. Thanks for the quick reply!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

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:  
cron
Powered by phpBB® Forum Software © phpBB Group