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

What happened in this code?

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

    What happened in this code?

    I used this example from the forum to draw a dot but I got like a directive error


    DrawText("WRB" + CurrentBar, true, ".", 0, High[0] + 2 * TickSize, System.Drawing.Color.Blue, largeFont, StringAlignment.Near, System.Drawing.Color.Transparent, System.Drawing.Color.Transparent, 0);


    I had to add "System.Drawing" before Color.Blue. Why is this happening if the directive System.Drawing is declared at the beginning of my code .

    This code is giving me the same problem with the "largefont" how can I fix this issue.

    Thanks

    #2
    Hello,

    Can you use these methods in another indicator without having to add System.Drawing?

    If it is only this script, would you be able to provided me with the full script you're using so I can test this on my end? You will find the file in (My) Documents\NinjaTrader 7\bin\custom\Indicator\<your indicator name>.cs

    Please upload this as an attachment, or email us at support[at]ninjatrader[dot]com with this file so we can look into this further.
    MatthewNinjaTrader Product Management

    Comment


      #3
      This is the indicator I could fix the Color adding the directive but I am still getting the same error with "largefont".

      Thanks
      Attached Files

      Comment


        #4
        Thanks - "color" is a reserved variable. Your private int color was preventing you from using the Color.Blue

        You should change this to another variable name such as "myColor".

        For the font, I do not see where you have specified the type of font used. In your private variables region, you can use something similar to Font largeFont = new Font("Arial", 12);

        Also your DrawText was missing the offset argument.

        The attached should compile. Please let me know if you have any questions.
        Attached Files
        MatthewNinjaTrader Product Management

        Comment


          #5
          Oh my god, I see it now, Thanks for the support

          Comment


            #6
            Hi,

            Would NT support please update this indicator? It's not working for the current version of NT7 (7.0.1000.43)

            Comment


              #7
              Hello Delerium,

              Are you seeing an error or what specifically is not working? We may be able to suggest a fix if there is some error happening.

              It looks like this is a users example for a problem they were originally having so it would be suggested to only review the script in post 4 for the changes we had suggested for the specific problems the user brought up. The script the user provided may no longer be valid or may work in an illogical way, I couldn't really comment on the logic in OnBarUpdate and how that is intended to work. If you are seeing it is not logically working you would have to use Prints similar to what it already has to diagnose the problem.





              JesseNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Tim-c, Today, 03:54 AM
              0 responses
              3 views
              0 likes
              Last Post Tim-c
              by Tim-c
               
              Started by FrancisMorro, Today, 03:24 AM
              0 responses
              3 views
              0 likes
              Last Post FrancisMorro  
              Started by Segwin, 05-07-2018, 02:15 PM
              10 responses
              1,772 views
              0 likes
              Last Post Leafcutter  
              Started by Rapine Heihei, 04-23-2024, 07:51 PM
              2 responses
              31 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by Shansen, 08-30-2019, 10:18 PM
              24 responses
              945 views
              0 likes
              Last Post spwizard  
              Working...
              X