I am new to coding.
I have a problem with boolean resetting to true, here goes-
#region Variables
private bool t1 = true;
private bool t2 = false;
private bool t3 = false;
private bool t4 = false;
.
.
.
.
#endregion
protected override void Initialize()
{
CalculateOnBarClose = true;
ExitOnCloseSeconds = 30;
SMA(Close, Fast).Plots[0].Pen.Color = Color.Orange;
SMA(Close, Slow).Plots[0].Pen.Color = Color.Green;
Add(SMA(Close, Fast));
Add(SMA(Close, Slow));
}
protected override void OnBarUpdate()
{
Condition Sets
.
.
.
.
.
if(t1 == true)
t1 = false;
t2 = true;
{
if (t1 == true)
if (t2 == false)
if (t3 == false)
if (t4 == false)
if(t2 == true)
t2 = false;
} t3 = true;
{
if (t1 == true)
if (t2 == false)
if (t3 == false)
if (t4 == false)
if(t3 == true)
t3 = false;
t4 = true;
}
On next bar update all t1 through t4 are resetting to true, even though these been set in coding.
I searched the forum but found no solution.
Thanks.

Comment