Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strange issue - DrawText and DrawTextFixed only work in indicators

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

    Strange issue - DrawText and DrawTextFixed only work in indicators

    Hi guys,
    I am about to give up. Tried 3 installations on two different systems (64 bit pc and 32 bit notebook) now and can not get anything printed on the chart in a strategy. When I paste simple code like

    DrawText("tag1", "Text to draw", 10, 1000, Color.Black);

    into the OnBarUpdate() method nothing is drawn. It works in an indicator and I have seen other threads with the exact same problem - and no solution.




    I have already tried the following things

    - reinstall
    - install on other pc
    - several overloaded / adapted versions
    - changed colors
    - run prescripted strategies that use DrawXXX


    and I have already uninstalled NinjaTrader completely a few minutes ago. I have developed strategies in MQL4 and MQL5, bought the launch pad book and invested almost 14 days now. If someone can tell me what I am missing, I will give Ninjascript another try. Does it work for you?

    #2
    Hello Justmyname,

    Thank you for your note.

    I noticed that your Text code is setting the Y Value to 1000, which will directly translate to the chart as well. You could use something like High[0] to get the High price series

    What instrument are you trying this piece of code on?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_Cal,
      unfortunately it is not an positioning issue. I also thought that could be the case, but it never works in any strategy, neithter with DrawText nor with DrawTextFixed. It DOES work in indicators.

      If you create a clean strategy and change the OnBarUpdate method like this

      protected override void OnBarUpdate()
      {
      DrawTextFixed ("STRING1","STRING2",TextPosition.Center);
      }


      does it work for you?

      Thank you in advance,
      justmyname

      P.S. I use 1M charts and the FXCM live feed, so it is not an CalculateOnBarClose problem...
      Last edited by justmyname; 03-22-2014, 01:21 AM.

      Comment


        #4
        Originally posted by justmyname View Post
        Hello NinjaTrader_Cal,
        unfortunately it is not an positioning issue. I also thought that could be the case, but it never works in any strategy, neithter with DrawText nor with DrawTextFixed. It DOES work in indicators.

        If you create a clean strategy and change the OnBarUpdate method like this

        protected override void OnBarUpdate()
        {
        DrawTextFixed ("STRING1","STRING2",TextPosition.Center);
        }


        does it work for you?

        Thank you in advance,
        justmyname

        P.S. I use 1M charts and the FXCM live feed, so it is not an CalculateOnBarClose problem...
        After you applied the strategy to the chart, have you actually enabled the strategy?
        Last edited by koganam; 03-22-2014, 06:48 AM.

        Comment


          #5
          Hello justmyname,

          Yes, this code works just fine in a clean strategy for me. Have you made sure your strategy is enabled like koganam suggested?

          If so but still not seeing anything, do you get an error message in your Log tab?
          JCNinjaTrader Customer Service

          Comment


            #6
            Hello guys,

            well this is kind of embarrassing! Of course it works!

            I was used to enable a strategy once in MT4 and MT5 and didn't notice that it has to be enabled again when I detach it from a chart and attach it again. I feel really stupid now. Sorry for that! Thank you for your kind help

            Comment


              #7
              Thank you again, you can close this thread now, because everything works fine. Often small issues take lots of time to solve for a newbie like me. I really appreciate the good support here!

              Best regards from Germany,
              Raimund

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              648 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              574 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X