Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by agclub, 04-21-2024, 08:57 PM
        4 responses
        18 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Irukandji, Today, 04:58 AM
        0 responses
        3 views
        0 likes
        Last Post Irukandji  
        Started by fitspressoburnfat, Today, 04:25 AM
        0 responses
        2 views
        0 likes
        Last Post fitspressoburnfat  
        Started by Skifree, Today, 03:41 AM
        1 response
        4 views
        0 likes
        Last Post Skifree
        by Skifree
         
        Started by usazencort, Today, 01:16 AM
        0 responses
        4 views
        0 likes
        Last Post usazencort  
        Working...
        X