Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Draw code within MarketAnalyzer

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

    Indicator Draw code within MarketAnalyzer

    My indicator draws fine on charts. When included in the market analyzer I had to set a variable to avoid the draw code for it to be included in my Market Analyser without locking up NT 7. Thank you.

    #2
    Hi ohowie,

    Can you please provide the code snippets so I can test this on my end?
    TimNinjaTrader Customer Service

    Comment


      #3

      if
      (MyInput0 == 1)
      if (!Historical || CurrentBar >= Bars.Count -2)
      {
      myTempstring =
      "+ " + Math.Round((CalcTakeProfit(1,true) - Close[0])/(TickSize),0).ToString() +
      " | " + Math.Round((CalcTakeProfit(1,false) - Close[0])/(TickSize),0).ToString();
      DrawTextFixed(
      "MyFixedStringTop", myTempstring, TextPosition.TopRight);
      myTempstring =
      "- " + Math.Round( (Close[0] - CalcTakeProfit(2,true))/(TickSize),0).ToString() +
      " || " + Math.Round((Close[0] - CalcTakeProfit(2,false))/(TickSize),0).ToString();
      DrawTextFixed(
      "MyFixedStringBottom", myTempstring, TextPosition.BottomRight);
      }
      Attached is CalcTakeProfit() submethod (function) placed below onbarupdate and before properties
      Attached Files

      Comment


        #4
        ohowie,

        I do not see anywhere in your code where you actually set a plot that MA could use. Have you tried outputting with Print()s to see where exactly it is calculating things?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          the plot was a simple sma(200) - sma(50) that works fine in the market analyzer as long as i dont call the code i sent you (MyInput0 = 2). It all works fine in 6.5, If i am the first report of such behavior i would not be concerned Josh. Forum reply box only allows 1000 characters. Let me know and I can send you the code in NT7 and NT6.5. Whichever you like just tell me how?
          Howie

          Comment


            #6
            Instead of a variable, you can also use this:

            if (ChartControl != null) // Draw in Chart only
            DrawText(...);

            Comment


              #7
              Indicator reference to Bar Object in IF Condition Stmt

              Thanks STR.

              JOSH... I think its that the Market Analyzer is ignoring Bar Object references in the IF condition ... i.e.

              if (!Historical || CurrentBar >= Bars.Count -2)


              So what appears to be what I refered to as an NT 7 freeze up could have been NT 7 doing the long calcs on each and every bar. Hope this helps.
              Howie
              Last edited by ohowie; 06-10-2010, 09:22 AM. Reason: formatting

              Comment


                #8
                Howie,

                Can you please attach a simple as possible complete script that demonstrates the issue so we can test your exact scenario on our end? Thank you.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks. We will get back to you at a later point in time.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    ohowie,

                    The issue is with in your code is with several of your while-loops:

                    Code:
                    [COLOR=blue][FONT=&quot]while [/FONT][/COLOR][FONT=&quot]((CTPClose- TakePrice) < (15*TickSize))[/FONT]
                    You are running into infinite loops and this needs to be addressed in your code. You can test this very quickly by commenting out your logic in CalcTakeProfit and just return TakePrice = Close[0].
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    591 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    342 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    103 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    555 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    552 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X