fh: What exactly does Series and PivotUp1 do here ?
07.06.2020 14.12

Algorithmic Trading with NinjaTrader


Tried to figure what the code means, but didn't get the idea yes.

Wondering what exacly is going on and for why exactly.

? Does it mean that with "Series"  all bars as many as i have available in data, put in a list called PivotUp1 ?

? and if PivotUp1 is being accessed, it fetches the value at pos 1 from it ?

  • Yuri Zolotarev
    07.06.2020 17:22

    When you create a plot in NinjaTrader inside indicator code or strategy code it uses something called Values which is essentially an array of arrays used to store data. So you can store a number inside Values[0][0] which will mean for an array located at index 0 (that is the first zero) 0 bars ago (that is the second zero) put in a number X like this:

    Values[0][0] = 1;

    Now when you make like 2-5 plots it becomes confusing because its hard to reference that in the code. You forget what is Values[0] and what is Values[1] they are unmeaningful. Therefore you create a parameter that you can call which can have a sensible name like PivotUp1.


    Value[0] is same as Values[0][0] but to access Values[1][0] you cannot go like Value[1] because Value[1] would mean value inside array Values[0] 1 bar ago.

    Hope this helps.