Maybe someone can help me out here. I am learning nt programming by writing code for very simple strategies.
I have added at the beginning
protected override void OnBarUpdate()
{
// Condition set 1
// If it's Monday, do not trade.
if (Time[0].DayOfWeek == DayOfWeek.Monday)
{
return;
}
else{ //Then check stuff and trade }
however, in strategy backtesting, it shows that trades are entered on Mondays.
My strategy is such that a position is opened on next candle (daily chart), so in the above code, no trades are entered on the Tuesday instead of Monday. So when I changed the day of the week to Sunday and then Friday, trades were still entered on the Monday.
Is there any way I can stop entering trades on Mondays?
Comment