I have bounced around the forums trying to find the missing piece of code I need but I can't quite narrow it down.
A brief summary of the strategy. It will enter a trade either long or short following a candlestick 1 bar ago that does not take out the high and the low of the candlestick 2 bars ago. I trade this pattern on the 15, 30, and 60 minute charts. See the code below, this section of code is for a short trade that is taken once the bid of the current bar goes below the Low [1] on the 30 minute data series.
Trades made on the 15 minute timeframe work perfectly, but when the code enters trades on the 30 and 60 minute I run into issues with Condition group 1. For context, when a successful trade runs its course and I am stopped out for a profit, I don't want to reenter a trade on that same candlestick. I want to wait for a new candlestick to open/form.
From what I have gathered, the issue is that the BarsSinceExitExecution is being applied on the 15 minute data series even though the trade is based on the 30 and 60 minute candlestick patterns.
How can I get the BarsSinceExitExecution to apply on the 30 minutes bars?
if ((Highs[1][1] <= Highs[1][2])
&& (Lows[1][1] >= Lows[1][2])
&& (GetCurrentBid(1) < Lows[1][1])
// Condition group 1
&& ((BarsSinceExitExecution(0, @"30RunnerBreakeven", 0) > 0)
|| (BarsSinceExitExecution(0, @"30RunnerBreakeven", 0) == -1)))
{
EnterShort();
}
If there is additional information you need me to provide just let me know. I've tried to keep the post brief but also allow you to get a handle on what I am trying to do with the strategy.
Thank you,
Nick

Comment