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

N/A Value

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

    N/A Value

    I am creating an indicator that will record the price each time a condition happens. However, the indicator only shows N/A when loaded in the chart. Since the indicator compiles, how can I find the error?

    Code:
        Period                        = 7;
    
                    AddPlot(new Stroke(Brushes.Blue, 2), PlotStyle.Dot, NinjaTrader.Custom.Resource.RangeValue);
                }
                else if (State == State.Configure)
                {
                    AddDataSeries(BarsPeriodType.Tick, 1);
                }
                else if (State == State.Configure)
                {
                    Volumen = VOL(); Print(Volumen);
                    wma = SMA(Volumen, Period); Print(wma);
    
                }
            }
    
            protected override void OnBarUpdate()
            {
                //Add your custom indicator logic here.
                if(CurrentBars[1] < Period)
                    return;
    
                if(BarsInProgress == 2){
                    if( CrossAbove(Volumen, wma, 1) )
                        Value[0] = Closes[1][0];
                }
            }​

    #2
    Hello Jorge.andres.o,

    Indicator plots are synchronized with the primary series, BarsInProgress 0, only.

    Further, you have a cross above condition that must be true for the plot series to be assigned a value. The plot will have not have a value assigned for all bars where there was no cross.

    Likely, you are not setting a value for every primary bar for the plot for BarsInProgress 0.

    Do you really want to be using a plot if you are not assigning a value on every primary bar?

    Perhaps you want to use a drawing object like Draw.Dot() to mark bars where a cross has occurred?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      Can you explain me the following?

      “…Likely, you are not setting a value for every primary bar for the plot for BarsInProgress 0.​..” can you provide and example please?

      “…Indicator plots are synchronized with the primary series, BarsInProgress 0, only…” Can I use multi-timeframes with the indicators?

      Thank you so much

      Comment


        #4
        Hello Jorge.andres.o,

        Attached is an example.


        Multi-time frame indicators must plot from the primary series only.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you for your help

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          3 views
          0 likes
          Last Post Option Whisperer  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          8 responses
          58 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by halgo_boulder, 04-20-2024, 08:44 AM
          2 responses
          21 views
          0 likes
          Last Post halgo_boulder  
          Started by mishhh, 05-25-2010, 08:54 AM
          19 responses
          6,189 views
          0 likes
          Last Post rene69851  
          Started by gwenael, Today, 09:29 AM
          0 responses
          5 views
          0 likes
          Last Post gwenael
          by gwenael
           
          Working...
          X