Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator display issue

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

    Indicator display issue

    I have an indicator that is only working (displaying) when I set the data series for the chart to Bars. When I set it to days it doesn't display. Are you able to look at the indicator and let me know what I'm missing or doing wrong? Can I send it to you or upload it here.

    #2
    Hello abandonedBaby,

    Thank you for your post.

    " I set the data series for the chart to Bars. When I set it to days it doesn't display."

    I'm not clear on what you are comparing here, can you please explain further?

    Days is a Data Series type (tick, minute, day etc). When you say you set the chart to "Bars" what exactly are you referring to? The chart style?

    Is this your own indicator, or one provided to you by a third party?


    To understand why the script is behaving as it is, such as not plotting when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the script add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

    Output from prints will appear in the NinjaScript Output window.

    The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very helpful to include labels and operators in the print to understand what is being compared in the condition sets.

    I'm also including a link to a forum post with further suggestions on debugging a script.


    Save the output from the output window to a text file. Let me know if you need assistance creating a print.​​​

    Comment


      #3
      When I open a chart and select The Time Frame it only works when I select Bars to something like 5000. When I change this this to days, like 3 day, my indicator doesn't show.


      Click image for larger version

Name:	image.png
Views:	67
Size:	17.1 KB
ID:	1307004

      Comment


        #4
        Hello abandonedBaby,

        Thank you for clarifying.

        This setting is how much data is displayed on the chart. When you select "Bars", you are choosing to display 5000 bars on the chart.

        When you select "Days", if you had entered (for example) 3 for the "Days to load" then 3 days worth of bars would be loaded on the chart.

        How much data is available on the chart would affect how much data is available for your indicator to calculate.


        To assess why your indicator is not plotting when you are loading data based on Days, you would need to debug the script per the instructions in my previous post.

        Comment


          #5
          I looked into this some more and discovered that as long as I have the chart to load data based on bars my indicator calculates and works. If I set it to load by days it does not, unless I had additional data series for the TF that my indicator is calling on.


          Example. If i create a chart based on bars like 5000 then it works. If i change it to load days instead it doesn't.

          Code:
          public class ContractVol : Indicator
          {
          
          private VOL VOL1;
          private VOL VOL2;
          
          protected override void OnStateChange()
          {
          if (State == State.SetDefaults)
          {
          Description = @"Dispalys volume for current and future contract";
          Name = "ContractVol";
          Calculate = Calculate.OnEachTick;
          IsOverlay = true;
          DisplayInDataBox = true;
          DrawOnPricePanel = true;
          DrawHorizontalGridLines = true;
          DrawVerticalGridLines = true;
          PaintPriceMarkers = true;
          ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
          //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;
          AddPlot(Brushes.Orange, "VOLCurrent");
          AddPlot(Brushes.Orange, "VOLNEXT");
          }
          else if (State == State.Configure)
          {
          AddDataSeries("NQ 06-24", Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last);
          AddDataSeries("NQ 09-24", Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last);
          }
          else if (State == State.DataLoaded)
          {
          VOL1 = VOL(Closes[1]);
          VOL2 = VOL(Closes[2]);
          }
          }
          
          protected override void OnBarUpdate()
          {
          Draw.TextFixed(this, "VOL_text", "CurrentVOL: " + Convert.ToString(VOL1[0]) + " | FutureVOL: " + Convert.ToString(VOL2[0]) , TextPosition.Center);
          }

          Comment


            #6
            Nevermind. I found the missing part I needed.

            Code:
            if (CurrentBars[0] < 1
            || CurrentBars[1] < 1
            || CurrentBars[2] < 1)// || CurrentBars[7] < BarsRequiredToPlot)
            return;

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            670 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            379 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            111 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
            582 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X