I'm totally new at this and I got some basic code that logs swing highs and lows that I created from the Strategy Builder.
I am looking to use the code in a custom indicator.
My question is how to use the "SwingStrength" Integer in the [BarsAgo]. (there is no way to set this in the Strategy Builder)
I have an Integer (user input) called "SwingStrength" and want to have that as the [BarsAgo] when plotting the chart markers and getting the time stamp.
I made the BarsAgo in the code below Bold Red.
Please see attached code.
Thank you for any help with this.
RMIperiod = 14;
RMIsmooth = 3;
SwingStrength = 5;
HiddenDivergence = true;
StandardDivergence = false;
H1 = 0;
H2 = 0;
H3 = 0;
L1p = 0;
L2p = 0;
L3p = 0;
H1i = 0;
H2i = 0;
H3i = 0;
L1i = 0;
L2i = 0;
L3i = 0;
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
Swing1 = Swing(Close, Convert.ToInt32(SwingStrength));
TOTrimi1 = TOTrimi(Close, Convert.ToInt32(RMIperiod), Convert.ToInt32(RMIsmooth));
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 3)
return;
// Set 1
if (Swing1.SwingHigh[0] != H1)
{
H3 = H2;
H2 = H1;
H1 = Swing1.SwingHigh[0];
Log(Convert.ToString(H1) + @"-H1p-" + Convert.ToString(Times[0][3].TimeOfDay), Cbi.LogLevel.Information);
Draw.Diamond(this, @"ppoc Diamond_1 " + Convert.ToString(CurrentBars[0]), false, 3, (High[3] + (10 * TickSize)) , Brushes.Blue);
H3i = H2i;
H2i = H1i;
H1i = TOTrimi1[3];
Log(Convert.ToString(H1i) + @"-H1i-" + Convert.ToString(Times[0][3].TimeOfDay), Cbi.LogLevel.Information);
}
// Set 2
if (Swing1.SwingLow[0] != L1p)
{
L3p = L2p;
L2p = L1p;
L1p = Swing1.SwingLow[0];
Log(Convert.ToString(L1p) + @"-L1p-" + Convert.ToString(Times[0][3].TimeOfDay), Cbi.LogLevel.Information);
Draw.Diamond(this, @"ppoc Diamond_2 " + Convert.ToString(CurrentBars[0]), false, 3, (Low[3] + (-10 * TickSize)) , Brushes.Red);
L3i = L2i;
L2i = L1i;
L1i = TOTrimi1[3];
Log(Convert.ToString(L1i) + @"-L1i-" + Convert.ToString(Times[0][3].TimeOfDay), Cbi.LogLevel.Information);
}

Comment