1. It looks like all the code is done in the "parimary page" under namespace NinjaTrader.NinjaScript.Strategies. Can we safely say that this page is the executable page or the main method in Java where code is written?
2. Speaking of main Methods, it looks like there are two primary methods, OnStateChange() and onBarUpdate(). It looks like onBarUpdate() is sort of like the Main Method where one would code what he/she wants the program to do in terms of implementing signals, and sending orders. This makes sense because on every update, new information is coming in which will be evaluated. Subsequently, if any are true, then orders would be sent out.
It also looks like OnStateChange() is composed of 3 different main classes, SetDefaults, Configure, and DataLoaded. Furthermore...
State.SetDefaults is where most default fields are set, and also variables you have initialized.
(detour question: if I have Calculate set to "onEachTick", does the onBarUpdate mean that it will update as each new tick is seen? In this case, the "Bar" is each new price(or tick)
State.DataLoaded looks to be drawings of indicators.
State.Configure. I don't understand what this is for expect that's where stop loss and targets are set. What is this object? What does it do and why are stops and profit targets set here?
I also don't understand the structure of if else-if statements these three objects are written here. It seems like the three objects are separate things and all of them can be true, not just one of them. Seems to me using three if statements would make more sense.
3. Can you write separate classes in NinjaScript and use objects in the "primary page"? Or is it only limited to simple methods that one can write at the bottom and everything has to fit in one page - the "primary page"
P.S. I was going to go with IB since they are Java based but their api is incredibly difficult for me to setup. In the end what I like about NT is that we only have to worry about writing the logic of the strategy and not have to worry about gateways, api, other technical necessities.
Looking forward to everyone's thoughts
Comment