Profile Picture

NewTime Method

Posted By rsheftel 9 Years Ago
Message
Posted Friday October 03 2008
I would like to suggest that RightEdge consider a new type of callback method based on time, lets call it "NewTime". This callback would get called at a specific time based on:

1) A time set in the startup (ie: call me at 3:59pm)

2) A repeating call based on an interval (call me every 30 minutes)

3) A time based on an the exchange hours. (call me 1 minute prior to exchange close)

My reason is that there are many trading systems and ways of trading that trigger not based on a tick or a price change, but based on the time of day. For example there are systems that would run every 30 minutes on the complete cross-section of a universe and buy/sell the cheapest/richest. Some systems may want to trade (or remove positions from the market) before economic number releases, or Fed meetings. And probably the most common would be systems that trade at the close.

What is the reason for needing a new callback? At this point the only way to accomplish this would be to wait for a tick and in the NewTick method look at the system clock to see if a time based trigger has been hit. This is dangerous because there are plenty of markets where the tick may be too late, you may want to exit a position 1 minute before the close, but if the last tick is 2 minutes you will never get a callback and cannot submit the order.

I understand this is not a trivial request, but I submit it to the queue and offer that it would certainly be differentiating for RightEdge as I am not aware of the competition having this functionality.

Posted Friday October 03 2008
Not to diminsh the value of your request, but why not put this in your trading system.  It seems easy enough assuming you're watching ticks.

rsheftel (10/3/2008)
I would like to suggest that RightEdge consider a new type of callback method based on time, lets call it "NewTime". This callback would get called at a specific time based on:

1) A time set in the startup (ie: call me at 3:59pm)

2) A repeating call based on an interval (call me every 30 minutes)

3) A time based on an the exchange hours. (call me 1 minute prior to exchange close)

My reason is that there are many trading systems and ways of trading that trigger not based on a tick or a price change, but based on the time of day. For example there are systems that would run every 30 minutes on the complete cross-section of a universe and buy/sell the cheapest/richest. Some systems may want to trade (or remove positions from the market) before economic number releases, or Fed meetings. And probably the most common would be systems that trade at the close.

What is the reason for needing a new callback? At this point the only way to accomplish this would be to wait for a tick and in the NewTick method look at the system clock to see if a time based trigger has been hit. This is dangerous because there are plenty of markets where the tick may be too late, you may want to exit a position 1 minute before the close, but if the last tick is 2 minutes you will never get a callback and cannot submit the order.

I understand this is not a trivial request, but I submit it to the queue and offer that it would certainly be differentiating for RightEdge as I am not aware of the competition having this functionality.

Posted Friday October 03 2008
The reason that just putting it in NewTick assumes that a tick will arrive at the exact time that you need it to, but there are many markets that do not tick that frequently. If you need to execute at the close, say an order at 3:59:30, but the last tick arrived at 3:59:15, then you would be out of luck and miss the close. Yes, you could hope that a tick arrives at the right time, but that is rife with potential for error.
Posted Friday October 03 2008
Right, but in Startup() you could instantiate a timer that watches the clock, so to speak, indepedent of ticks.

rsheftel (10/3/2008)
The reason that just putting it in NewTick assumes that a tick will arrive at the exact time that you need it to, but there are many markets that do not tick that frequently. If you need to execute at the close, say an order at 3:59:30, but the last tick arrived at 3:59:15, then you would be out of luck and miss the close. Yes, you could hope that a tick arrives at the right time, but that is rife with potential for error.
Posted Friday October 03 2008
Sounds like what I want, can you give me an example of how this would work? Maybe I am not familiar enough with that concept.
Posted Sunday October 05 2008
http://www.developer.com/lang/other/article.php/792901 here's a decent explanation and sample

rsheftel (10/3/2008)
Sounds like what I want, can you give me an example of how this would work? Maybe I am not familiar enough with that concept.
Posted Sunday October 05 2008
I see, so you are saying I can put a Timer event in the RightEdge Startup() block and set it to call the NewTick() method or any other method of my choosing? I can assume that when my system code is running inside RightEdge this timer still has full access to control execution? If so that would definitely seem to accomplish what I wanted.
Posted Sunday October 05 2008
Note that the events on the timer are probably raised in a different thread than your system is running.  You will need to call back into the system thread before doing anything (such as accessing indicators, submitting orders, etc).  Otherwise you may have weird threading bugs that happen sporadically.  You can call back into the system's thread using the SystemData.SynchronizationContext object.  Let us know if you need more guidance on how to use it.

Thanks,
Daniel

Posted Wednesday October 29 2008
Given the extra complication involved with threading it might be best that RE implements the feature correctly and safely to avoid any weird threading bugs that happen sporadically.

The event really only needs to be fired periodically and the handler can check the time of day, rather than providing one-shot timers which could become messy and tricky to debug.

FYI - OpenQuant has such an event ....


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems