Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Message Center ???

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

    Message Center ???

    Hello,

    I am looking to put a message center "box" or "area" on my chart --like in the lower left hand corner--where the indicator will report different things as they happen. For Example, it might display...Up Trade Signaled at 1234.75 or Trend is confirmed at 1334.50.

    I'm sure there is a way to control where the Text prints and how long it is displayed, like maybe 5 lines, and when the 6th line is generated, the first line would be removed.

    I have looked at the DrawText command but without a detailed example I don't know if this is the right way to start. Is there something better or more dedicated to printing text on the screen?

    Any suggestions or pointers welcome. I'm not asking for anyone to write the code (unless there is a canned script you know of), just push me off in the right direction.

    Thanks.

    #2
    Originally posted by sarasotavince View Post
    Hello,

    I am looking to put a message center "box" or "area" on my chart --like in the lower left hand corner--where the indicator will report different things as they happen. For Example, it might display...Up Trade Signaled at 1234.75 or Trend is confirmed at 1334.50.

    I'm sure there is a way to control where the Text prints and how long it is displayed, like maybe 5 lines, and when the 6th line is generated, the first line would be removed.

    I have looked at the DrawText command but without a detailed example I don't know if this is the right way to start. Is there something better or more dedicated to printing text on the screen?

    Any suggestions or pointers welcome. I'm not asking for anyone to write the code (unless there is a canned script you know of), just push me off in the right direction.

    Thanks.
    Look up DrawTextFixed in the NT Help.

    Comment


      #3
      Did that. In fact, NT help screens doesn't help me at all. I find the examples are incomplete and over simplified. I tried to use the sample code and nothing displayed on my screen. I did not use a condition, just placed the code under OnbarUpdate and still nothing. The rest of my code is working...

      Comment


        #4
        DrawTextFixed("myText","THIS IS A TEST",TextPosition.TopLeft,Color.Green, largeFont,Color.Blue, Color.Blue, 3);

        took this example straight from another post and "largeFont" is not working...where in NT help does it list the font style,size,bold, whatever...that does work?

        Comment


          #5
          OK, figured out that largeFont was a variable...sounded like a hard-wired term to me at first, so, the message center has a beginning. I am wondering if you could code your various messages as strings, print string1, string2, string3, string4 each followed by a break, so that it would look like:

          string1
          string2
          string3
          string4

          then rename the strings 1 = 2, 2=3, 3 =4, to move them "down" a line on the next printing, and print string1 at the top each time.....any thoughts???

          Comment


            #6
            Originally posted by sarasotavince View Post
            OK, figured out that largeFont was a variable...sounded like a hard-wired term to me at first, so, the message center has a beginning. I am wondering if you could code your various messages as strings, print string1, string2, string3, string4 each followed by a break, so that it would look like:

            string1
            string2
            string3
            string4

            then rename the strings 1 = 2, 2=3, 3 =4, to move them "down" a line on the next printing, and print string1 at the top each time.....any thoughts???
            You would print it as one string with line breaks, but yes, you should be able to handle shifting your data that way. By "rename string", I am presuming that you mean "copy the string into the next string".
            Code:
            string PrintsString = ...string1\n...string2\n...string3\n...string4;
            DrawTextFixed(..., PrintString, ...);
            Last edited by koganam; 12-19-2013, 08:26 AM.

            Comment


              #7
              Hello.

              Thank you for posting and Thank you Koganam for answering.

              Yes, this would be the method to create the different string messages that you are looking to do.

              Let us know if we can be of further assistance.
              Cal H.NinjaTrader Customer Service

              Comment


                #8
                I will be working on this over the next few days. I appreciate all the help and will post again if I get stuck.

                Comment


                  #9
                  Using the code:

                  string PrintsString = ...string1\n...string2\n...string3\n...string4; (I placed this in the variable section, right?)

                  I got a ton of errors. I do understand what it is saying-- to combine all strings into one string and print the one string with:
                  DrawTextFixed(..., PrintString, ...); (no problems with this section of code)

                  So my question is this:

                  Do I really use the dot dot dot before string1? Or do those dots mean something else you might have assumed I know? Yes, NinjaTrader_Cal, I need more assistance. In short, I need to exact code to combine multiple strings. What exactly come next:

                  string PrintsString = ???????

                  I know the \n gives a line break.

                  Thanks so much.

                  Comment


                    #10
                    Originally posted by sarasotavince View Post
                    Using the code:

                    string PrintsString = ...string1\n...string2\n...string3\n...string4; (I placed this in the variable section, right?)

                    I got a ton of errors. I do understand what it is saying-- to combine all strings into one string and print the one string with:
                    DrawTextFixed(..., PrintString, ...); (no problems with this section of code)

                    So my question is this:

                    Do I really use the dot dot dot before string1? Or do those dots mean something else you might have assumed I know? Yes, NinjaTrader_Cal, I need more assistance. In short, I need to exact code to combine multiple strings. What exactly come next:

                    string PrintsString = ???????

                    I know the \n gives a line break.

                    Thanks so much.
                    The dots are the standard English ellipsis, indicating that there may be other text there.

                    ref: http://grammar.ccc.commnet.edu/gramm...s/ellipsis.htm

                    Comment


                      #11
                      Yes and Thank You... I know the standard usage of [ ... ] but being new to NinjaScript I thought that was required code.

                      I also tried without the ellipsis like this:

                      string PrintsString = string1\nstring2

                      And that produced errors like unrecognized charactor [ \ ] , etc.

                      When I put the string1\nstring2 in [ " "] like this

                      string PrintsString = "string1\nstring2"

                      I literally get:

                      string1
                      string2

                      not what is in the strings themselves.

                      So, as a novice who has researched as best I can, I am seeking the proper coding to combine two or more strings, each string on its own line, in:

                      string PrintsString = [what]string1[what]\n[what]string2[what]

                      because nothing I have tried works, like + or & (these work in other languages)

                      Thanks again.

                      Comment


                        #12
                        Originally posted by sarasotavince View Post
                        Yes and Thank You... I know the standard usage of [ ... ] but being new to NinjaScript I thought that was required code.

                        I also tried without the ellipsis like this:

                        string PrintsString = string1\nstring2

                        And that produced errors like unrecognized charactor [ \ ] , etc.

                        When I put the string1\nstring2 in [ " "] like this

                        string PrintsString = "string1\nstring2"

                        I literally get:

                        string1
                        string2

                        not what is in the strings themselves.

                        So, as a novice who has researched as best I can, I am seeking the proper coding to combine two or more strings, each string on its own line, in:

                        string PrintsString = [what]string1[what]\n[what]string2[what]

                        because nothing I have tried works, like + or & (these work in other languages)

                        Thanks again.
                        As you are concatenating string variables, you want to write it like this instead. I made too many assumptions, sorry. I give an example. (Really, it is just that "\n" is itself a string, so must be properly written as such).
                        Code:
                        string PrintsString = "This is string1: " + string1 +  "\nThis is string2: " + string2 + "\nString3: " + string3; //etc
                        Last edited by koganam; 12-21-2013, 10:56 AM. Reason: Corrected spelling.

                        Comment


                          #13
                          Message Center Solved (basically)

                          OK to get this entire thing to work I defined the variables

                          string printsString = "placeholder"
                          string string1 = "whatever message you are using"
                          string string2 = "whatever other message you are using"



                          then under OnBarUpdate I placed as the very last code:

                          string printsString = string1 + '\n' + string2; // it's the ' ' around the \n that does the trick.

                          DrawTextFixed("myText",printsString,TextPosition.T opRight,Color.Green, largeFont,Color.Blue, Color.Blue, 3);

                          And this displays the two lines on the screen. I plan to use various IF statements to determine what messages get displayed by using the replace command for each string

                          For example, [in code] if this is greater than that
                          {string1 = "Exit the trade now";}

                          and when the code gets to the very last lines, whatever values are in the strings will be displayed. I might rotate the lines down with simple replace commands as discussed earlier or I might use just two lines as a message center / trade status. Lots of possibilities and I appreciates everyone's help. When I get time I will post a working model as a sign of my thanks.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by chrischongpdx, Today, 09:39 PM
                          0 responses
                          7 views
                          0 likes
                          Last Post chrischongpdx  
                          Started by Mountain_cast, Today, 12:41 PM
                          2 responses
                          9 views
                          0 likes
                          Last Post Mountain_cast  
                          Started by dontpanic, 04-07-2015, 04:42 AM
                          4 responses
                          1,322 views
                          0 likes
                          Last Post BeachTrader11807  
                          Started by algospoke, Today, 07:54 PM
                          0 responses
                          5 views
                          0 likes
                          Last Post algospoke  
                          Started by Rxxar, Today, 06:26 PM
                          0 responses
                          10 views
                          0 likes
                          Last Post Rxxar
                          by Rxxar
                           
                          Working...
                          X