Timer or System.Threading.Timer
Timer or System.Threading.Timer
24 Dec 2017, 08:08
Hi Guys,
I would like my timer to start exactly at a specified time with 1 second intervals following. with the API Timer I can initialize it with a interval but not with a start time?
I really like the System.Threading.Timer and I can specify a exact start time with this timer however according to this post (/forum/calgo-support/3577?page=1#9) cAlgo API's is not thread safe and one should not use this timer HOWEVER the post is old.
Can I use System.Threading.Timer to place orders at specified time? or is there a work around?
What I want to do:
At calendar event, 5 seconds before the news event released place orders and adjust their SL and TP at 1 second intervals for next 4 seconds.
PanagiotisCharalampous
27 Dec 2017, 15:14
Hi gunning.ernie,
I don't think the post's author meant it this way. A more accurate inteptretation of what is suggested in the post is
"Don't do it if you don't know how to do it. cAlgo will not take care of this for you."
Concluding, you can use System.Threading.Timer as long as you know how to handle concurrency issues i.e. what should happen if two threads access the same resource at the same time e.g. start modifying the same order.
Best Regards,
Panagiotis
@PanagiotisCharalampous