That’s all nonsense. If a broker fills in the instrument specifications in a way that doesn’t match the actual quotes, your library will be lying just as much as the broker.
You can run an example on Finam.
That’s all nonsense. If a broker fills in the instrument specifications in a way that doesn’t match the actual price quotes, then your library will be lying just as blatantly as the broker.
You can run the example on Finam.
I can add an option to import sessions by day via sinput files.
. Now, when sessions change, I calculate not only the end time of the current session but also the start time of the next session. As a result, there is now just one check:
if(time < this.NextTradeStart ) { return false; }
. Now, when sessions change, I calculate not only the end time of the current session but also the start time of the next session. As a result, there is now just one check:
This is the most correct approach for calculating whether a time falls within any given interval. For example, if trading is to take place from 12:00 to 15:00, then a similar ‘NextTime’ approach should be used.
Of all the third-party code I’ve seen, yours is the only one that does this.
I haven’t looked into it in great detail, but it seems that the current implementation assumes that a session must fall strictly within a single day, which isn’t the case when there is a significant difference in time zones; that is, for example, if European sessions are traded via an Asian broker, or vice versa. In other words, there are cases where the ‘To’ time is earlier than the ‘From’ time if you ignore the date in the datetime.
if(!TradeSession.isSessionTrade(TimeCurrent())){Print("Market closed. OnTick return");return;}Instead of
TimeCurrent() You can set any value you like, by the way.Session times are taken from the broker or can be set manually.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Control_Trade_Sessions:
Library for trading session control. At startup it counts the time of trading sessions for all 7 days of the week (on Sat and Sun there can be cryptocurrency trading), up to 10 sessions per day. Then in OnTick() you can do checks, and if a tick came in outside the trading session, you can exit further processing of it.
Author: Aleksei Kuznetsov