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

Drawing Objects disappear

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

    Drawing Objects disappear

    Hallo,

    I have programmed an indicator which properly does it's calculations.
    If it's values reach certain levels, it draws a triangle into the chart:

    double offset=ATR(10)[0];
    DrawTriangleUp("MyTriangleUp", true, 0, High[0]+offset, Color.Green);

    However, when I scroll through the chart there are some triangels which disappear
    during scrolling. Even when I scroll back they don't appear any more.
    The indicator values themself don't change when disappearing happens.
    Might there be a bug?
    Seems like disappearing takes place whenever triangels are closed to each other (max. 15 candles away from each other).

    #2
    Stephan123, thanks for the post - what exact NT version are you using here as you observe this? You can check it under Help > About in the software.

    If you scroll the chart and the issue appears, do you see any log error entry then in the right most tab of the Control Center?

    Thanks,
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I use 7.0.1000.2
      Seems like there are no entries generated in the log file if disappearing happens.
      However, there are entries generated during every compiling procedure,
      which are related to a strategy, which is not used during occurence of the
      disappearing. The strategy itself runs without errors and compiling works out as well, though. That's the related entry:

      03.05.2011 14:35:09 Strategy Failed to call method 'Initialize' for strategy 'MrWeitII/1e3beee8ae054e1b8d300f0189b4be9a': Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.

      Comment


        #4
        Yes, this entry is seen as the Initialize() is called across all scripts and not only the particular one you're running, so it would good to inspect this strategy's Initialize() to determine where you could run into accessing an empty object then to be able to fix it.

        I would also suggest to upgrade to our R4 via Help > Download Site and then retest your script.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I have updated to R4. Still same problem.
          I checked the Initialize of the mentioned strategy.
          Nothing obvious. Here it is.

          Code:
          protected override void Initialize()
                  {
                      Add(DoubleStochastics(Close, 12));
                      double Variable1 = 4.5*ATR(20)[0];
                      double Variable2 = 1.5*ATR(20)[0];
                      SetStopLoss("Long-Entry", CalculationMode.Price, Variable1, true);
                      SetProfitTarget("Long-Entry", CalculationMode.Price, Variable2);
          
                      CalculateOnBarClose = true;
                  }
          There is definitely something weird with it.
          After upgrading there were even less signals plotted on the chart, although they should have. After recompiling the indicator I got the same behaviour as before-disappearing triangels in the chart.

          Comment


            #6
            Stephan, please move the logic for your dynamic Stoploss to the OnBarUpdate() section, this is something we don't recommend doing in the Initialize() as the bars object is the not yet guaranteed to be present, while it would be in OnBarUpdate().

            For the indicator script still giving you issues: would you mind us testing it here on our end?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              -Removed the dynamic SL and TP .
              Log entry doesn't occure anymore.
              DIssappearing still occures.
              I can send you the script.
              Where should I send to?

              Comment


                #8
                Ok, thanks for offering Stephan - please contact me directly at: support at ninjatrader dot com - Attn Bertrand.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by andrewtrades, Today, 04:57 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by chbruno, Today, 04:10 PM
                0 responses
                3 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                436 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                7 views
                0 likes
                Last Post FAQtrader  
                Started by rocketman7, Today, 09:41 AM
                5 responses
                19 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X