NinjaMonitor 3 - Keep an eye on your automated strategies from anywhere

Forum > NinjaTrader Plugin > Strategy Settings Template


  • NinjaMonitor
    Administrator


    This is a little tip we've developed using NinjaTrader that can be useful, so I'll be sharing it here.

    As you know, a NinjaTrader Strategy can have many 'inputs'. Sometimes you can have one strategy that you wish to run in different charts with different input settings.

    By default in NinjaTrader, the only way, would be to write down your settings and for each graph insert the strategy with the correct settings.
    As you can imagine, this can be quite fragile, especially if you need to re-insert a strategy after a crash.


    Say we have our main strategy, and 4 different charts we wish to insert it in, each with different settings.
    Our trick, is to use the advantages of Object Oriented Programming.

    So our main strategy, would be our "base" class, and we'll create 4 new strategies, each of them will only contain the settings.
    NinjaTrader uses the Initialize() method to read inputs, so we'll put our new settings in there.

    Now for some code...


    public class MyStrategy1 : MainStrategy
    {
    protected override void Initialize()
    {

    base.Initialize(); // Make sure we call the base class Initialize Method
    foo=4;
    bar=3;

    }
    }



    posted 4 years ago


  • Post Reply

    You must Login or Register