I have an indicator that identifies a pattern of two consecutive inside bars. I would like to set a strategy that places a stop order (either buy or sell) when the currentbar passes the high (buy) of the or the low (sell) of the second inside bar.
Here is my script logic:
if ( High[0]<=High[1] && High[1]<=High[2] && Low[0]>=Low[1] && Low[1]>=Low[2] ) //checks for inside/inside bar
{
if (High[0]>High[1]) // if high of current bar breaks the high of inside bar then buy
{
EnterLongStopLimit(Convert.ToInt32(DefaultQuantity ), (High[1] + .25), (High[1] + .25), @"IBCloseLongEntry");
SetStopLoss(@"IBCloseLongEntry", CalculationMode.Ticks, 16, false);
SetProfitTarget(@"IBCloseLongEntry", CalculationMode.Ticks, 4);
}
// Set 2
if (Low[0]<Low[1]) // if low of current bar breaks the los of inside bar then sell
{
EnterShortStopLimit(Convert.ToInt32(DefaultQuantit y), (Low[1] - .25), (Low[1] - .25), @"IBCloseShortEntry");
SetStopLoss(@"IBCloseShortEntry", CalculationMode.Ticks, 16, false);
SetProfitTarget(@"IBCloseShortEntry", CalculationMode.Ticks, 4);
}
It does not seem to take the entries as expected. I am using calculate on each tick (as I think I would need that to enter the stop order on the current bar and would not want to wait til bar close).
Any suggestions on making this strategy work?

Comment