An issue occurred with my trading strategy. It seems that the trading strategy
has a problem with “half trading” days (e.g. 24th of December). That means that my trading strategy is programmed in that way that after every trading day all variables will be reset in order to be clear for the next trading day. I even have implemented a
query to avoid possible confusions regarding variable settings of the previous day and the next trading day as follows:
protected override void OnBarUpdate()
{ …
if (
Bars.FirstBarOfSession && // Display only once a session
FirstTickOfBar && // at first Tick of a bar
CurrentBar > 0 && // My preference to start after the first bar of the session
Time[0].DayOfWeek != DayOfWeek.Saturday && // No weekends
Time[0].DayOfWeek != DayOfWeek.Sunday // No weekends
)
{
//RENEWABLE VARIABLE AREA - RESET VARIABLES
ResetVariables();
}
if (Time[0].DayOfWeek != Time[1].DayOfWeek)
{
ResetVariables();
//RENEWABLE VARIABLE AREA - RESET VARIABLES
}
…
}
But even with this queries the trading strategy on “half trading” days trades the next day with the same variable settings like the
day before. It seems like the strading strategy does not realize that a new trading day or better a new trading session started and therefore
the strategy trades with “old” variable settings of the days before.
Do anybody has an idea how to prevent this issue I described above?
Many thanks,
bye
Rob

Comment