I am new to C# and I am working to convert my code from my previous coding language into Ninjatrader.
What I could do in my original code was I could reference previous values of definitions.
For instance, I could make the strategy calculate a current value based upon a previous value of that value.
Here is my code as of now:
Note that I am trying to use [1] to reference the previous value of that definition.
However, the code is not compiling and I cannot reference these values.
Any help is appreciated, thank you!
if (myCCI > 0) { MT1 = (Math.Max(MT1[1], Median[0] - ATRCCI)); } else { MT1 = (Math.Min(MT1[1], Median[0] + ATRCCI)); } // Alignment of two different indicators if ((Close[0]> Stade) & (Close[0] > MT1)) { double State2 = (StateUp); } else if ((Close[0] < Stade) & (Close[0] < MT1)) { double State2 = StateDn; } else double State2 = State2[1]; if (Math.Max(State2 != State2[1])) Math.Max(newState = bar); else Math.Max(newState = 0);
Comment