I'm attempting to create a strategy that holds the position for 1 day (1 bar since I'm on the daily timeframe). More specifically, I want to hold a long position all day on Tuesday if Monday is red -- from market open to market close. I'm able to get the entry to work, but the exit seems to be an issue for the current state of my code. Are there any functions along the lines of "BuyAtOpen", "ExitOnClose", or "SetExitOnClose". Perhaps I'm simply thinking about the problem incorrectly. Below is the code I have thus far. Thanks for the help!
protected override void OnBarUpdate()
{
if (CurrentBars[0] < 1)
// Set 1
if ((Times[0][0].DayOfWeek == DayOfWeek.Monday) && (Close[0] < Open[0]))
}
It appears as if my final line of code is delaying the exit to the opening of the final day. I'm assuming there is an easy fix to this I'm overlooking.

Comment