Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Value plot always return 0

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

    Value plot always return 0

    Hello
    I wanted to develop average High and Low indicator over the past N period but I don't know what I did wrong that the plot value always returns 0. Please help.
    Thank you very much.

    Code:
    protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Average high of N bars ago";
                    Name                                             = "AvgHigh";
                    Calculate                                        = Calculate.OnPriceChange;
                    IsOverlay                                        = true;
                    DisplayInDataBox                           = false;
                    DrawOnPricePanel                         = true;
                    DrawHorizontalGridLines                = false;
                    DrawVerticalGridLines                    = false;
                    PaintPriceMarkers                          = false;
                    ScaleJustification          = NinjaTrader.Gui.Chart.ScaleJustification.Overlay;
                    //Disable this property if your indicator requires custom values that cumulate with each new market data event. 
                    //See Help Guide for additional information.
                    IsSuspendedWhileInactive                    = true;
                    Period                                        = 3;
                    
                    AddPlot(Brushes.Orange, "AvgHigh");
                    
                }
                else if (State == State.Configure)
                {
                
                }
            }
    
            protected override void OnBarUpdate()
            {
                Value[0] = SMA(High, Period)[0];
            }
    Last edited by thebigarch; 03-29-2017, 08:46 PM.

    #2
    Hello,


    Thank you for the post.

    I tried this code on an ES 06-17 chart and can see this plotting a value. Are you seeing any errors in the log tab or new -> NinjaScript output window?

    Could you provide more details on the chart you are using as well, along with the Period you used?

    Also if you have just added the plot to the script and used F5 to reload, please try to remove the indicator and readd it to the chart.

    I look forward to being of further assistance.

    Comment


      #3
      Hello Jesse
      Unfortunately for me, I've tried this code with a lot of instruments without luck. I didn't see any error in the output window when compiling. And I readded it every time with new instruments. The period is 3.
      I've attached images of the chart that my indicator plots value 0 and also image of the indicator setting.

      Please advise.
      Thank you.
      Attached Files
      Last edited by thebigarch; 04-05-2017, 08:52 AM.

      Comment


        #4
        Hello,

        Thank you for the reply.

        Unfortunately, I am not able to see this happen in my tests. Are you able to apply an SMA or any other indicator and see a value plotted other than zero on this chart?

        Could you upload the actual script you are working with for me to review? You can export the script using the instructions here: http://ninjatrader.com/support/helpG...nt7/export.htm

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        51 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        31 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        165 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        100 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        160 views
        2 likes
        Last Post CaptainJack  
        Working...
        X