SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Thu Feb 27, 2020 8:38 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Jun 24, 2011 1:32 am 
Offline

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

I'm trying to create some code logic which will utilize OnQuote data, but only trade once per day. For example, the logic enters a market order on the daily open, runs a series of logic, and then once the trade is closed, wait for the text trading day before another opening order can be sent.

Probably something the following:

bool dailyDuration = true;
count = 0;

if (current.TimeOfDay > start.TimeOfDay && current.TimeOfDay < end.TimeOfDay)
{
return true;
count++;
}
/***************************and then place in the execution logic**********

if (count = 0)
***Trade Logic***
else (count => 1)
*** Don't Trade Logic***

My thought is that the when the count registers (0), the trade will happen in the OnQuote logic. The problem is resetting the count each day for that single trade to occur per day. Should I utilize another counter in the 'day' portion of the DateTime data?
I'm just tying to find out what the best standard method for this would be and I know a lot of guys will trade a single position on the opening normal exchange hours, so I thought there is a better way to do this.
Any help would be much appreciated.

Cheers,
Red


Top
 Profile  
 
PostPosted: Fri Jun 24, 2011 8:47 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
Hi,

have you thought about using a timer? viewtopic.php?f=64&t=6229

Cheers,
Anton


Top
 Profile  
 
PostPosted: Fri Jun 24, 2011 9:05 pm 
Offline

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

I'll give it a try to add enough time to close out the day, and then have the program restart within hours the next morning.
Something like:
AddTimer(Clock.Now.AddHR(8));


Eric


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

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