Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Plots Multi Instrument

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strategy Plots Multi Instrument

    Gday all,

    I am trying to PLOT multiple instruments in my strategies. I have looked at the samples and docs and i think i have added the multi instruments correctly. However I dont know the syntax for drawing a plot line in the UI panels.

    Here is my code structure:
    protected override void Initialize()
    {
    CalculateOnBarClose = false;
    Add("ZN 09-08", PeriodType.Minute, 1); //BarsArray 1
    Add("^TRIN", PeriodType.Minute, 1); //BarsArray 2

    Add(StrategyPlot(0));
    StrategyPlot(0).Plots[0].Pen.Color = Color.YellowGreen;
    StrategyPlot(0).PanelUI = 2;

    Add(StrategyPlot(1));
    StrategyPlot(1).Plots[0].Pen.Color = Color.YellowGreen;
    StrategyPlot(1).PanelUI = 3;


    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {


    StrategyPlot(0).Value.Set(EMA(BarsArray[1],5)[0]);
    StrategyPlot(1).Value.Set(Closes[2][0]);


    }


    What am i missing?

    Cheers.

    #2
    Hi raz0rback,

    What do you mean by plot lines? Each StrategyPlot() you add will essentially be 1 line. You could add more StrategyPlot()s and set them to take the value of whatever line you want to draw and use the .PanelUI to put them into whichever panel you want.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      thanks for the quick reply Josh.

      What you suggest is what I thought would happen. However, what is happening is the 2 indicator panels are being created but not line is plotted.


      is there some other code i need to enter the data into the strategyplot dataseries and then to draw the plot of that dataseries?

      Comment


        #4
        I think code wise that should do it. Only thing I can think of is if you actually have enough data in your bar series to populate it. Please try switching it to one instrument different time periods to check your code for if it works or not. Also check out the Control Center for fishy error messages.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh,

          I have spent several hours trying to resolve this problem. I have recently tried running the "SampleStrategyPlot" file on my system.

          I have found the same error.

          Charts do not show the strategy plots at all.

          Is this a bug with ninja? I cant figure this out.

          Steve

          Comment


            #6
            Josh,

            Further to that, there is no error msgs. The strategy seems to request the data for the multiple instruments but not plotting. I have also tried just using one instrument and plotting multiple timeframes to no avail.

            any help is appreciated.

            Comment


              #7
              What version of NinjaTrader are you running? Please take note that it will not work for backtesting in the Strategy Analyzer. Not a bug; rather a limitation.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                6.5.1000.4



                Machine ID: 83E3881DF8EDA04D7E1399A5332FBFD1
                .NET Version: 2.0.50727.1434
                Expiration: 31/12/2099

                Really not sure what is going on but as I said it doesnt display the sample so there must be some underlying issue.

                Thanks

                Comment


                  #9
                  Are you backtesting or are you live? Please confirm running SampleStrategyPlot on a 1min chart of AAPL that has data for at least a few days.

                  1. Connect to your data feed
                  2. Open a 1min chart of AAPL
                  3. Wait for chart to populate
                  4. Throw SampleStrategyPlot on the chart
                  5. Confirm that you see two plot lines on the price panel

                  Please beware that you need enough data for all time periods/instruments.
                  Last edited by NinjaTrader_JoshP; 06-26-2008, 03:24 AM.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    backtesting.

                    i have tried running the sample on the same version of NT on another machine. Same result. Both are vista 64bit. Not sure if that has anything to do with it.

                    gee mate you work hard. shouldnt you be sleeping at these hours?

                    Comment


                      #11
                      Backtesting will not work. The feature only works on realtime charts.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        its always the simple things that baffle people.

                        cheers mate.

                        Comment


                          #13
                          Originally posted by NinjaTrader_Josh View Post
                          Hi raz0rback,

                          What do you mean by plot lines? Each StrategyPlot() you add will essentially be 1 line. You could add more StrategyPlot()s and set them to take the value of whatever line you want to draw and use the .PanelUI to put them into whichever panel you want.
                          Josh

                          I have been plotting from my strategy for months thanks to strategyplot. I now want to plot a channel..i.e. upper and lower boundaries to the main plot.

                          Based on what you are saying "...essentially be 1 line...", do I have to add separate strategyplots for each line?...or is there an easier way (such as adding the 2 extra lines to the exiting strategplot indicator...which I have not been able to get working so far)

                          Thanks

                          ps. adding the two extra strategy plots works fine...just thought there might be a more elegant solution than adding more indicators
                          Last edited by ATI user; 10-09-2008, 05:44 AM.

                          Comment


                            #14
                            ATI user,

                            Unfortunately there is no other solution we can currently offer you.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Thanks Josh

                              Is there a way to shade the area between the two outer indicators?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              666 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              377 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              110 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              575 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              580 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X