• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Please help with indicators plotted by a strategy

  • Filter
  • Time
  • Show
Clear All
new posts

    Please help with indicators plotted by a strategy

    I am trying to apply some indicators to my strategy and have three of them (cumulative delta, momentum2 and T32 - see below) plot overlaid in a single panel below the price, while T35 should be overlaid on the price. Also, momentum2 should be plotting bars, not line. Twenty emails later with the customer service bring me no closer to being able to do that.

    I have inserted in the strat the instructions from the 'Help guide - Strategies' as below, but the result can be seen in the attachment: despite supposedly printing the blue SMA in a separate panel, it still overlays it on price.

    As for the indicators I am trying to use in my strat, cumulative delta and momentum plot in separate panels, while T32 is plotted on the price panel, so I have to drag and drop momentum and T32 over the cumulative delta panel, then change the momentum from line to bars by hand to get to the screenshot attached.

    The part of the strat below has been generated with the builder.

    Can someone please help? The help guide is obviously either missing important info, or it assumes that whoever reads a page is aware of what it missing and that is not me.

    Thank you

    else if (State == State.Configure)
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    Brush1 = new SolidColorBrush((Color)ColorConverter.ConvertFromS tring("#FFCCCCCC"));

    else if (State == State.DataLoaded)
    OrderFlowCumulativeDelta1 = OrderFlowCumulativeDelta(Close, NinjaTrader.NinjaScript.Indicators.CumulativeDelta Type.BidAsk, NinjaTrader.NinjaScript.Indicators.CumulativeDelta Period.Session, Convert.ToInt32(0));
    T31 = T3(OrderFlowCumulativeDelta1.DeltaClose, Convert.ToInt32(T3Period), 3, 0.7);
    Momentum1 = Momentum(T31, 1);
    Momentum2 = Momentum(T31, 1);
    T32 = T3(OrderFlowCumulativeDelta1.DeltaClose, Convert.ToInt32(T3Period), 3, 0.7);
    T33 = T3(Close, Convert.ToInt32(T3PeriodPrice), 3, 0.7);
    OrderFlowCumulativeDelta2 = OrderFlowCumulativeDelta(Close, NinjaTrader.NinjaScript.Indicators.CumulativeDelta Type.BidAsk, NinjaTrader.NinjaScript.Indicators.CumulativeDelta Period.Session, 0);
    T34 = T3(OrderFlowCumulativeDelta2.DeltaClose, Convert.ToInt32(T3Period), 3, 0.7);
    Momentum3 = Momentum(T34, 1);
    Momentum4 = Momentum(T34, 1);
    T35 = T3(Close, Convert.ToInt32(T3PeriodPrice), 3, 0.7);
    Momentum5 = Momentum(T31, 1);
    Momentum6 = Momentum(T31, 1);
    //IsOverlay = false;
    Momentum2.Plots[0].Brush = Brushes.Chocolate;
    OrderFlowCumulativeDelta1.Plots[0].Brush = Brushes.Transparent;
    OrderFlowCumulativeDelta1.Plots[1].Brush = Brushes.Transparent;
    OrderFlowCumulativeDelta1.Plots[2].Brush = Brushes.Transparent;
    OrderFlowCumulativeDelta1.Plots[3].Brush = Brush1;
    T32.Plots[0].Brush = Brushes.Yellow;
    T35.Plots[0].Brush = Brushes.Yellow;

    // This is the Help guide instruction

    // Set the plots color for the added indicator
    ChartIndicators[0].Plots[0].Brush = Brushes.Blue;

    // Set the added indicator to new panel
    ChartIndicators[0].Panel = 1;

    //End of help guide instruction

    //ninZaBarStatus1.Plots[0].Brush = Brushes.Transparent;
    //ninZaBarStatus1.Plots[1].Brush = Brushes.Transparent;
    Attached Files

    Hello itrader46,

    A good place to start is with a working example.

    Below is a link to an example that changes the panel of an indicator that is added with AddChartIndicator().

    I've copied the relevant code you have provided to a script and provided an export for you so that you can import and test it.
    Is the export demonstrating the same behavior?

    As a tip, to export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    Attached Files
    Chelsea B.NinjaTrader Customer Service



      Thank you for your reply.

      I will try that later, but now I have another issue: the output screen and the chart data box show different values at the same time, as you can see from the screenshots attached. The values in the output are almost, but not exactly, as the ones shown by the data box for the previous bar, which make my signals a bar late.

      Thank you
      Attached Files


        Hello itrader46,

        Are you focusing on the #T3Mom;27.9972300882364 appearing at 14:03:42?

        This appears to be the Momentum9[0] value.

        This is initiated using the input source of the T32.

        Momentum9 = Momentum(T32, 1);

        T32 appears to be the T3 indicator using the OrderFlowCumulativeDelta1.DeltaClose as the input source.

        T32 = T3(OrderFlowCumulativeDelta1.DeltaClose, Convert.ToInt32(T3Period), 3, 0.7);

        OrderFlowCumulativeDelta is using the parameters below.

        OrderFlowCumulativeDelta1 = OrderFlowCumulativeDelta(Close, NinjaTrader.NinjaScript.Indicators.CumulativeDelta Type.BidAsk, NinjaTrader.NinjaScript.Indicators.CumulativeDelta Period.Session, 0);

        I'm not seeing that AddChartIndicator() is being used to add these indicators to the chart using the parameters and input sources configured in the strategy.

        Are you adding these indicator separately and verifying all parameters and input sources are the same?

        If you add the indicators with AddChartIndicator() instead, do these show the same values?
        Chelsea B.NinjaTrader Customer Service


          Hi Chelsea.

          I've looked over the link in your first reply and managed to do something similar.

          I am struggling, though, when I try to add in the default state the Plot Style and Dash Style for the momentum indicator. I am trying to get the momentum to plot as dotted bars, rather than line.
          I got as far as plotting the momentum plot as bars, but I can't get the dotted bars and I cant get them in the properties.

          Momentum1 = Momentum(T31,1);
          Momentum1.Plots[0].Brush = Momentum1Brush;
          Momentum1.Plots[0].PlotStyle = PlotStyle.Bar;
          //Momentum1.Plots[0].DashStyleDX = DashStyles.Dot; ### I get an error saying something about DashStyleDX being read only and I not sure how to sort it out.

          Would you be able to help me with this, please?



            Hello itrader46,

            Are you wanting to set the PlotStyle to PlotStyle.Dot?

            The SharpDX stuff is dependent on the RenderTarget and will not be something you can set from the strategy.
            Chelsea B.NinjaTrader Customer Service


              Yes, that's what I was trying to achieve.

              I run into another issue now, with the PnL calculation.
              I have enable my strat @ 22:30 last night and it now shows a $600 and I am not sure where is that coming from.

              Would you be able to figure it out from the attachments, as I can't understand?

              Thank you
              Attached Files
              Last edited by NinjaTrader_ChelseaB; 03-21-2019, 06:12 AM.


                Hello itrader46,

                I have removed your log from your post as this can contain sensitive information. In the future please do not post your log, trace, or any other personal information publicly on the forums.
                Instead, send these to platformsupport [at] ninjatrader [dot] com with a link to the relating forum thread.

                Are you able to see the trades in the Trade Performance window?

                Do these add up to the PnL on the account?

                If not, may I have a screenshot of the trades display in the Trades Performance window?

                Are you seeing the orders on the Orders tab of the Control Center?

                Do the orders in these windows match what is in the log?
                Chelsea B.NinjaTrader Customer Service


                  Hi Chelsea

                  I attached the trades window screenshot, but I can't see the trades there adding up to -$700 from 20th, 22:30 to 6am this morning

                  Attached Files


                    Hello itrader46,

                    Is every one of these trades placed by the strategy?

                    Or are the trades from the strategy the Equities trades?

                    Are these the same trades that appear in the Strategy Performance Real-time?

                    This appears to be from -10,353.50 to -12,045.80 a difference of -1,692.30..

                    Was the strategy ever disabled and re-enabled during this time?

                    Did the strategy place all of the orders with the Strategy marked as Equities?

                    Chelsea B.NinjaTrader Customer Service


                      Hi Chelsea

                      No, I refer to the period 10pm on the 20th to 6am on the 21st, when the strat worked on its own, as I was sleeping, 10353 to 10551 = 198


                        Hi Chelsea

                        I managed to have the same indicator readings in the strategy as in a chart without the strategy, by setting the strat to calculate on each tick.
                        Would I be able to have the strat execute entries - exits on each tick, but print the indicating arrows and play the alert sounds at the close of bar?



                          Hi Chelsea

                          I have another issue now: my strat (see attached) doesn't plot the T3 moving averages, basically out of the blue. I deactivated the strat, activated it again and the T3s are not plotted anymore, even though I've done nothing to change it.
                          I restarted the platform and the PC with no results so far.
                          Last edited by itrader46; 03-25-2019, 10:40 AM.


                            Hello itrader46,

                            Chelsea is out of the office today, but will get back to you as soon as he returns.

                            ​​​​​​​Thanks for your patience.
                            Josh G.NinjaTrader Customer Service


                              Hello itrader46,

                              I wanted to check, are you seeing any errors in the log tab?

                              I tried applying the script you attached and I can see it plotting the T3 plots on my end. I did not observe it long enough to see if it would trade or anything else, but it does appear to enable and plot.

                              I look forward to being of further assistance.
                              JesseNinjaTrader Customer Service


                              Latest Posts


                              Topics Statistics Last Post
                              Started by elnoppo, Today, 01:25 PM
                              1 response
                              Last Post NT-Roland  
                              Started by FabianoTrader, Today, 04:00 PM
                              2 responses
                              Last Post FabianoTrader  
                              Started by FabianoTrader, Today, 03:53 PM
                              0 responses
                              Last Post FabianoTrader  
                              Started by swcooke, Today, 11:18 AM
                              2 responses
                              Last Post swcooke
                              by swcooke
                              Started by pjsmith, Today, 01:56 AM
                              1 response
                              Last Post NinjaTrader_ChelseaB