SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Mar 26, 2019 7:20 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Tue Jun 14, 2011 1:25 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Well, we can add RemoveTimers method without arguments which deletes all active timers.

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Tue Jun 14, 2011 1:30 pm 
Offline

Joined: Thu Mar 10, 2011 10:09 pm
Posts: 582
Would be usefull. And other forum users in above also requested it.


Top
 Profile  
 
PostPosted: Fri Jun 17, 2011 2:13 pm 
Offline

Joined: Thu Mar 16, 2006 12:15 pm
Posts: 184
Does somebody have an example for datacleaning using timers?

_________________
Expect the unexpected. May your MM/RM be with you.


Top
 Profile  
 
PostPosted: Fri Jun 17, 2011 2:21 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6811
What is datacleaning?


Top
 Profile  
 
PostPosted: Sat Jun 18, 2011 8:56 pm 
Offline

Joined: Thu Mar 16, 2006 12:15 pm
Posts: 184
datacleaning: Ignoring/deleting bad data (most oft the time just some quotes/trade events that are way off the market)...

_________________
Expect the unexpected. May your MM/RM be with you.


Top
 Profile  
 
PostPosted: Tue Jul 12, 2011 6:31 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
I'm trying to get a timer which fires once a day to reset an variable called 'positionCount'
I'm getting this error:
'MyStrategy.OnTimer(System.DateTime)': no suitable method found to override

I've pasted the affected code here. I don't really understand why it's producing this error. Thanks in advance for your assistance.

public override void OnBar (Bar bar)
{
barcount ++;
if (barcount > 1)
{
if(DurationWithinWorkingHours(bar.DateTime))
{
if (positionCount < 4)
{
if (longShort == 1)
{
if (!HasPosition) //(entryEnabled = true)
{
Order marketOrder = MarketOrder (OrderSide.Buy, Qty, "Initial Long Order, Entry");
marketOrder.Send();
AddTimer(bar.DateTime.Date.Add(new TimeSpan(01, 00, 00)));
}
}
else
if (longShort == 0)
if (!HasPosition)
{
{
Order marketOrder = MarketOrder (OrderSide.Sell, Qty, "Initial Short Order, Entry");
marketOrder.Send();
}}
}}}}


public override void OnTimer(DateTime dateTime)
{
positionCount = 0;
}


Top
 Profile  
 
PostPosted: Tue Jul 12, 2011 6:38 pm 
Offline

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


Code:
public virtual void OnTimer(
   DateTime datetime,
   Object data
)


Object data is a user data that you can pass in


Code:
public void AddTimer(
   DateTime datetime,
   Object data
)


Regards,
Anton


Top
 Profile  
 
PostPosted: Tue Jul 12, 2011 6:56 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Thanks Anton, And many thanks for the quick reply!


Top
 Profile  
 
PostPosted: Fri Oct 24, 2014 4:46 pm 
Offline

Joined: Wed Sep 18, 2013 10:50 am
Posts: 67
Location: London
Hi

Is it possible to remove a timer with a specific object when the datetime of that timer is not known?

Something like

RemoveTimers(Objective.SayHello); // Removes all the timers with object set to "Objective.SayHello"

Regards
Maddy


Top
 Profile  
 
PostPosted: Fri Oct 24, 2014 9:52 pm 
Offline

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

are you talking about OQ2014 ?

Regards,
Anton


Top
 Profile  
 
PostPosted: Fri Oct 24, 2014 10:00 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6811
As far as I can see there is no such functionality in OQ2013, but I guess you can have a workaround and keep a list of objects from "disabled" timers and then in OnTimer check if timer's object is in this list or not.

Something like

OnTimer(DateTime dateTime, Object obj)
{
if (disabledTimers.Contains(obj))
return;

....
}

Regards,
Anton


Top
 Profile  
 
PostPosted: Mon Oct 27, 2014 12:16 pm 
Offline

Joined: Wed Sep 18, 2013 10:50 am
Posts: 67
Location: London
Thanks Dr. Anton.


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

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