Topics
Replies
Spotware
19 Mar 2014, 14:25
RE:
AlexanderRC said:
There are no guaranties of internal cAlgo/cTrader code to be reentrant. With the approach of the timer, I would have moved all of the custom code into a separate method. That method should be called from OnTimedEvent(), OnTick() and OnBar(). That method should include some sort of synchronization primitive to guard against simultaneous invocation from OnTick()/OnBar() and from OnTimedEvent().
But even that does not guarantee that you do not go through some non-reentrant internal code paths when executing that method from OnTimedEvent().
AlexanderRC is right. Please avoid of using Timer classes.
In future we will introduce cAlgo.API.Timer which will guarantee that only one thread is working with API objects.
@Spotware
Spotware
18 Mar 2014, 10:05
So if using a timer isn't safe, data isn't updated inside a loop and there is no event triggered for pending orders, how do you suggest that one writes code to be instantly notified of changes to pending orders?
You can not implement it in current version of API
@Spotware
Spotware
18 Mar 2014, 09:14
RE:
tekASH said:
Hello Admin
today while opening cTrader I was asked to download updates of 12.5 mb...usually, after installign updates it shows what's new....but this it didnt. What novelties are installed lately?
note: I had installed February updates prior to this one.
cTrader had to to be updated, because we extended cAlgo.API. History collection was added.
cTrader was optimized and several minor issues were fixed in last release.
@Spotware
Spotware
17 Mar 2014, 17:35
At the moment you can use only Positions.Opened and Positions.Closed events. You can post your idea to vote.spotware.com.
@Spotware
Spotware
17 Mar 2014, 17:32
System.Timers.Timer uses ThreadPool threads. Please avoid using System.Timers.Timer because while you are accessing cAlgo.API objects from timer's thread, cAlgo could decide to update such objects from another thread. In such case there is a possibility that data will be corrupted and entire application could fail.
We are going to implement cAlgo.API.Timer which will guarantee that only one thread works with API objects per time.
@Spotware
Spotware
17 Mar 2014, 17:31
System.Timers.Timer uses ThreadPool threads. Please avoid using System.Timers.Timer because while you are accessing cAlgo.API objects from timer's thread, cAlgo could decide to update such objects from another thread. In such case there is a possibility that data will be corrupted and entire application could fail.
We are going to implement cAlgo.API.Timer which will guarantee that only one thread works with API objects per time.
@Spotware
Spotware
17 Mar 2014, 14:13
Traffic in and traffic out are hidden in case if our application can not find some PerformanceCounters in your operation system.
@Spotware
Spotware
17 Mar 2014, 10:22
RE:
madopter said:
I would like to make the move from MT4 to cTrader/cAlgo but tick-testing is a must-have. It's a deal-breaker for me as long as it's not available -- is there any estimate regarding when tick-testing would be implemented in cAlgo?
This feature is in our short term roadmap. We are going to release it in couple of months.
@Spotware
Spotware
17 Mar 2014, 09:57
OnTick method is invoked when platform receives new quotes for the corresponding symbol.
Using of System.Threading.Timer class is not recommended, because its callback is invoked in different thread, while cAlgo.API is not thread safe. It could cause crash of application.
If you want to invoke OnTick handler more frequently than ticks come, you can subscribe OnTick handler to MarketDepth.Updated event.
For example:
protected override void OnStart() { MarketData.GetMarketDepth(Symbol).Updated += OnTick; }
In this case OnTick handler will be invoked on any update of DOM.
@Spotware
Spotware
20 Mar 2014, 14:02
cAlgo.API doesn't contain advanced take profit functionality.
@Spotware