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

Modifying Plot does not work

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

    Modifying Plot does not work

    I want to customize the @swing Indicator. (by extending my own Class).

    By an additional correction I modify the Low-Plot within the High-Plot Loop (and vice versa)
    But the Low Plot dataseries doesn't change. Seems like the dataseries ist in an like write protection mode ...

    I checked the Details with the visual Studio Debugger.

    This is the line I want to write to the Low-Plot:
    swingLowPlot.Set(lastSwingLowBar + i , lastSwingLowValue);

    lastSwingLowBar + i is a valid int value, for instance: 3
    lastSwingLowValue is a valid double value, for instance: 1234,00

    The Plot value will not draw on Chart.
    Looking into swingLowPlot in Debug Mode after this line shows no changes in it's dataseries.

    what's wrong? Do I somethig wrong ?

    regards
    t

    #2
    Hello Trandy,

    Thanks for your note.

    So that I may test this, may I have the full .cs file of your modified script?

    I'll take a look and see why it may not be accepting your changes.

    I look forward to your reply.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea, thanks for the response,

      I uploaded th AdvancedSwing Indicator as an usabel example. This Indicator contains some failures in advanced Bars and this doesn't matter for this example, so please check only the first Bars.

      The related code follows. Please look at the red bold line.
      If you check this in debug mode you'll se after the setting, that there is still the old value in the Plot.

      Best regards
      Trandy

      <Snippet>
      if (isSwingHigh){
      Print ("High @ Bar " + (CurrentBar - strength) + " with " + swingHighCandidateValue);
      // If there is a new High without a Low since last High,
      // we check for the losen Low
      // We check the Lows since last High to now -strentgh
      // and detecting the lowest Low
      // We memorize this Low value and the Bar position
      if(lastSwingLowBar < lastSwingHighBar){
      Print("Missing Low between Bar " + lastSwingHighBar + " and Bar " + (CurrentBar - strength));
      int llb = lastSwingHighBar;
      int barsBack;
      for(int i=llb; i < CurrentBar - strength ; i++){
      barsBack = (CurrentBar - i) ;
      Print ("Checking Bar " + i + " (CurrentBar - " + barsBack + "): Low[" + barsBack + "] = " + Low[barsBack]);
      if(Low[barsBack] < Low[CurrentBar - llb])llb = i;
      Print ("llb ist nun " + llb ) ;
      }
      barsBack = CurrentBar - llb;
      lastSwingLowBar = llb;
      lastSwingLowValue = Low[barsBack];

      Print ("setting SwingLowPlot of Bar " + (lastSwingLowBar) + " for " + (CurrentBar - lastSwingLowBar - strength) + " Bars with value " + lastSwingLowValue);
      for (int i=0; i <= CurrentBar - lastSwingLowBar - strength ; i++){

      SwingLowPlot.Set(lastSwingLowBar + i , lastSwingLowValue);
      swingLowSeries.Set(lastSwingLowBar, lastSwingLowValue);
      }
      }
      </Snippet>
      Attached Files

      Comment


        #4
        Hello Trandy,

        Thank you for the indicator file.

        Running this, I am getting an OnBarUpdate error. When SwingLowPlot is set it calls Update() which runs OnBarUpdate to update all values before returning a value.

        The error in specific was barsAgo needed to be between 0 and 255 but was 291. This is caused by the maximum lookback period. To conserve memory an indicator by default is set to only look back 256 bars. To call data further than this amount you will need to set this to infinite.

        For example:
        MaximumBarsLookBack = MaximumBarsLookBack.Infinite;

        Below is a link to the help guide on MaximumBarsLookBack.
        http://www.ninjatrader.com/support/h...rslookback.htm


        Please let me know if this does not resolve your inquiry.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          thanks for the fast reply.
          I copied my origin Indicator and did some translations to english before sending. It seems, there were still some overlapping with my origin indicator (=> generated code of NT), so this error don't occur in my environment - sry.

          But checking your point, I realized: I tried to set the Plot with absolute addressing, but dataseries has to be adressest relative to the currentBar -> the error was between my ears ...

          Sorry for the false alarm and thanks for the fast help.

          Best regards
          Trandy

          Comment


            #6
            Hello Trandy,

            Thanks for updating me about this.

            I'm glad to hear you were able to resolve the issue.

            Please do not hesitate to contact us for any other NinjaTrader inquiries you may have.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,221 views
            0 likes
            Last Post xiinteractive  
            Started by andrewtrades, Today, 04:57 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            7 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            438 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            9 views
            0 likes
            Last Post FAQtrader  
            Working...
            X