for the last days i been conding a strategy based in breack a level and after trow an fibo from the previously high till the second low swing anfter cross the level
the problem is the strategy never stop the calc once there is a 3rt min the strategy uses the new min and never stop
do you know how can i make the strategy use just the 2nd min after the break?(then i will place the order in the fivo level, etc..) and do not calculate more untill the price breack again the level?
protected override void OnBarUpdate()
{
if (CurrentBar < BarsRequiredToTrade)
return;
if (CurrentBars[2] < BarsRequiredToTrade)
return;
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 5
|| CurrentBars[2] < 1)
return;
// Set 1 i set a level once is cros below
if (CrossBelow(Closes[2], ConstantLines1.Line1, 1))
{
K1 = Line1;
}
// starst counting to know how many bars are after cros the level and after usit for refer the previous swing high
if (CrossBelow(Close, K1, 1))
{
startbar = CurrentBar;
}
// Set 2 i set the 2 swing lows after the breack level and the swing ghig before ad i draw a fibo
if ((Close[0] <= K1)
&& (Swing1.SwingLow[4] < Swing1.SwingLow[5]) && (Swing1.SwingLow[5] != FirstMin))
{
FirstMin = Swing1.SwingLow[4];
SecondMin = FirstMin;
FirstMin = Swing1.SwingLow[5];
FirstHigh = Swing1.SwingHigh[(CurrentBar - startbar +2)];
if (FirstMin <= K1)
{
Draw.FibonacciRetracements(this, @"kai2 Fibonacci extensions_1", false, 0, FirstHigh, 0, SecondMin);
if (FirstMin != 0) ;
Draw.Dot(this, @"diferentsTemps Dot_1", false, 0, FirstMin, Brushes.CornflowerBlue);
if (SecondMin != 0)
Draw.Dot(this, @"diferentsTemps Dot_2", true, 0, SecondMin, Brushes.GreenYellow);
if (FirstHigh != 0)
Draw.Diamond(this, @"diferentsTemps Diamond_1", true, 0, FirstHigh, Brushes.Red);
}

Comment