Since going live I’ve had a number of trading errors and now I’ve finally got to the bottom of two I believe.
The first was simple. The new trending strategy was giving me an “Access Violation” error when it tried to trade. After spending a while trying to reproduce this and debug it, compared to other strats that could trade, I discovered that the problem was caused by having semi-colons in the QTXT field. Easy fix.
The next problem was that sometimes strategies would fail to trade on market open and would end up being paused until I manually restarted them. After doing some research I believe this is related to how FXCMs trading hours open. According to:
“For FXCM LTD (UK) and FXCM LLC (US), the quoted hours for the Trading Desk are from Sunday 5:15 PM (EST) through Friday 5:00 PM (EST). For FXCM Australia, the quoted hours for the Trading Desk are from Monday 7:15 AM (AET) – 7:00 AM (AET) Saturday.”
So it appears the markets did not open as cleanly as I thought. FXCM Trading Station is setup in Server Time which appears to be Sydney Time, UTC+10. The VM is setup to be on UTC time.
It appears to fix this problem I need to check if the date time is tradeable or not by using the method core.isnontrading() …. More details can be found on the following example: http://fxcodebase.com/wiki/index.php/Using_Other_Time_Frame_Price_Data_in_Indicator_(Yesterday_Close_Value_indicator)
The question is, what to do if I detect a trading opportunity while the market is open but non-tradeable. Should I enter an order, or should I wait until market opens and execute that trade, or should I just leave it to re-assess when trading opens…
At least for a first point, I need to stop the strategies from entering paused state.