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

New line for each text output

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

    New line for each text output

    Code:
            // Print the current 7 period SMA of range .
                DrawTextFixed("AverageDailyRange1", "Average Daily Range: " + SMA(AverageDailyRange, 7)[0].ToString("N2"), TextPosition.TopLeft);
                DrawTextFixed("AverageDailyRange2", "Stop Loss: " + ((SMA(AverageDailyRange, 7)[0])*.10).ToString("N2"), TextPosition.TopLeft);
                DrawTextFixed("AverageDailyRange3", "Target Profit: " + ((SMA(AverageDailyRange, 7)[0])*.15).ToString("N2"), TextPosition.TopLeft);
    How do I get each text line (i.e average daily range readout, stop loss read out, etc) on a seperate line. I tried \n, but they still ended up on the same line overlapping each other. Thanks.

    #2
    please disregard. the /n now works.. must have been some anomoly.

    Comment


      #3
      I guess my question would be now, how do you make the text output (default is black apparently) different, like the stop loss text red and target profit green

      Comment


        #4
        Hi ericadam,

        You can choose the coloring of the DrawTextFixed() method. Please use this syntax:

        DrawTextFixed(string tag, string text, TextPosition textPosition, Color textColor, Font font, Color outlineColor, Color backColor, int opacity)
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          tried to compile this:
          DrawTextFixed("AverageDailyRange1", "Average Daily Range: " + SMA(AverageDailyRange, 7)[0].ToString("N2"), TextPosition.TopLeft, Color.Green);

          But it fails - "No overload for method "DrawTextFixed" takes '4' arguments"

          Comment


            #6
            ericadam,

            You need to use the complete list of arguments. Please take a look at the Help Guide article on DrawTextFixed here for more information: http://www.ninjatrader-support.com/H...TextFixed.html
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              still getting errors after using the whole proper syntax:

              DrawTextFixed("AverageDailyRange2", "\nStop Loss: " + ((SMA(AverageDailyRange, 7)[0])*.10).ToString("N2"), TextPosition.TopLeft, Color.Green, Font.Bold, Color.White, Color.White, 5);

              Comment


                #8
                Give this a try:
                Code:
                DrawTextFixed("AverageDailyRange2", "\nStop Loss: " + ((SMA(AverageDailyRange, 7)[0]) * 0.10).ToString("N2"), TextPosition.TopLeft, Color.Green, new Font("Arial", 10), Color.White, Color.White, 5);
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  thanks, it worked. I guess examples of the syntax would be helpful on the help page. The font threw me off. Thx

                  Comment


                    #10
                    Is there a way to round the values to increments of .25? (i.e. the ES increment)

                    Comment


                      #11
                      Please use Round2TickSize: http://www.ninjatrader-support.com/H...2TickSize.html
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        thanks, can I get a quick example of the syntax

                        Comment


                          #13
                          nvm, got it. Just popped it around the code

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by rocketman7, Today, 02:12 AM
                          6 responses
                          27 views
                          0 likes
                          Last Post rocketman7  
                          Started by guillembm, Yesterday, 11:25 AM
                          3 responses
                          16 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by junkone, 04-21-2024, 07:17 AM
                          10 responses
                          148 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Started by tsantospinto, 04-12-2024, 07:04 PM
                          6 responses
                          101 views
                          0 likes
                          Last Post tsantospinto  
                          Started by trilliantrader, 04-18-2024, 08:16 AM
                          7 responses
                          28 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Working...
                          X