I'm running an automated strategy across multiple markets and I want it to stop sending signals during certain times of the day when there's noise (economic indicators, etc).
This works well with the ToTime function, but I'm having trouble when integrating all (market specific) "no trade times".
Here's an example for a single market (the DAX):
if (Instrument.MasterInstrument.Name == "FDAX" && ToTime(Time[0]) > 81000 && ToTime(Time[0]) < 143000 || ToTime(Time[0]) > 143000 && ToTime(Time[0]) < 155000 || ToTime(Time[0]) > 160000)
{
TradingHoursDax = true;
}
This works well but it has to be adapted for every market (MasterInstrument.Name is modified).
Now, when integrating all markets into one line of code, it looks like this:
if (TradingHoursDax == true || TradingHoursEuro == true etc)
{
TradingHours = true;
}
Finally, TradingHours = true is integrated into my trading criteria, but this is where it stops working.
The strategy simply ignores it and executes a signal even if it triggers during a "no trade time".
Any idea on what went wrong here would be much appreciated.
Thanks
Comment