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

Input.IsValidPlot() on indicator with multiple plots

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

    Input.IsValidPlot() on indicator with multiple plots

    The new facility for checking if Input bars have been set, works fine when the "Input Series" is set to the primary plot of an indicator.
    But if I set "Input Series" to say the secondary plot of the same indicator, I find that IsValidPlot is actually reporting the status of bars in the primary plot.

    So at present IsValidPlot seems to have a bug where it is always looking at Values[0] even though user has set the Input to be a different plot of the indicator.

    #2
    Hello,

    Not sure I understand this: But if I set "Input Series" to say the secondary plot of the same indicator.

    Can you give me an example of what you mean here so that I can make sure we are on the same page.

    Thanks.

    Comment


      #3
      Steps to reproduce the problem

      Step 1) Create an indicator with more than one plot, with an easily identifiable different pattern of using Set on each plot. Here's an example called TestPlot

      Code:
       protected override void Initialize()
              {
                  Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "PlotA"));
                  Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "PlotB"));
                  Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Line, "PlotC"));
      			BarsRequired=0;//dont hide any bars on chart
                  Overlay				= false;
              }
      
              protected override void OnBarUpdate()
              {
                  if (CurrentBar%2==0) PlotA.Set(.0001);//Alternating pattern Set, Not-Set
                  PlotB.Set(.0002);//All bars set
                  //PlotC.Set(.0003);//No bars set
              }
      Step 2: Create an indicator to test IsValidPlot. Here's an example called TestIsValidPlot

      Code:
      protected override void Initialize()
              {
                  Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Value"));
      			BarsRequired=0;//dont hide any bars on chart
                  Overlay				= false;
              }
      
              protected override void OnBarUpdate()
              {
                  if (Input.IsValidPlot(CurrentBar)) //Using CurrentBar checks status of current bar (opposite indexing to ContainsValue)
      			{
                  	Value.Set(1);
      			}
      			else
      			{
      				Value.Set(0);
      			}
              }
      Step 3: Do the testing.
      Test 1) Put TestIsValidPlot on a chart, to check IsValidPlot works with default Input of Close.
      Expected Result: All bars=1 (since all bars are always Set for Close).
      Actual result: Pass.

      Test 2) Change the "Input Series" for TestIsValidPlot to Indicator TestPlot. The default plot is what I am calling the "primary plot" (here should be PlotA automatically selected).
      Expected result: Alternating pattern of 0's and 1's (since we Set every other bar in PlotA).
      Actual Result: Pass.

      Test 3) Change the "Input Series" so that "Plot" is changed to PlotB (of same indicator). This is what I was calling "the secondary plot of the same indicator" in previous post.
      Expected Result: All bars should be 1 (because we Set all bars for PlotB).
      Actual Result: Alternating pattern of 0's and 1's.
      Test Status: FAIL.
      Conclusion: Input.IsValidPlot is currently hard-coded to look at only the primary plot of the Indicator (here TestPlot.PlotA) ie Values[0], even if user has selected another plot (here TestPlot.PlotB, or Values[1]).

      Test 4) Same as Test3 except choose PlotC for Input.
      Expected result: All bars should be 0 (since we did not set any bars for PlotC)
      Actual Result: Same as Test3.
      Test Status: FAIL.
      Conclusion: See Test 3.

      Comment


        #4
        Hello,

        Thanks for steps.

        I'm following up with development and will report back.

        May be monday before you hear back from me.

        Thanks for your patience.

        Comment


          #5
          Hello,

          Development looked into. This is currently expected however due to so much design being build around this changing this is no trivial matter. There is no idea what we would break by making this change.

          Therefor development has added it on their list to look into for a future major release of the software which unfortunately will be sometime down the road.

          Let me know if I can be of further assistance.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by mattbsea, Today, 05:44 PM
          0 responses
          3 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          31 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          2 views
          0 likes
          Last Post tkaboris  
          Started by GussJ, 03-04-2020, 03:11 PM
          16 responses
          3,282 views
          0 likes
          Last Post Leafcutter  
          Started by WHICKED, Today, 12:45 PM
          2 responses
          20 views
          0 likes
          Last Post WHICKED
          by WHICKED
           
          Working...
          X