Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PrintTo output2

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

    PrintTo output2

    I only want to print certain values into output2, I have default value setup as output1 but certain indicator values I just want them in the outpu2, what syntax to achieve this?


    #2
    Hello Boonfly8,

    The PrintTo can be set at any time. You can set this to one tab print something then set this to another tab and print something else.

    PrintTo = PrintTo.OutputTab2;

    Below is a public link to the help guide which includes an example.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thank you for your response. I think it would be best if I clarify further. On my OBU methods I have a lot of Print() right now for debugging but on some indicator outputs, I want to specifically print those to the output2 window, for better organization.

      For example, I have something like

      Print("Signal")
      Print" SMA value")
      Print("Stop loss in ticks")
      Print(ADX)
      Print(RSI)

      I would like to print ADX and RSI to the output2.

      I have tried settings the PrintTo, but it just dumps all the logs to the output2 window

      Comment


        #4
        Hello Boonfly8,

        So you are not having an issue printing to Tab2...

        Instead, you are having an issue with what is being printed.

        Are you trying to print the value of the most recent bar of the adx?

        Print(ADX()[0]);

        You need to use parenthesis when calling a method and you need to select a barsAgo index for the bar you want the value from.

        Below is a public link to the help guide on the ADX().


        And a public link to a forum post with helpful information about getting started with NinjaScript.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          I do not have an issue with the output2 window but rather I want some output value printed to output window2 in addition to the default window. For example, if I have these lines of output on OBU

          If (SMAFAST >= SMASLOW)
          {

          Print("Buy Signal at 8:30:00am)
          Print(Position.AveragePrice)
          Print" SMA value")
          Print("Stop loss in ticks")
          Print(ADX)
          Print(RSI)
          }

          the above is just pseudo code , but when the conditions meet, i purge those values, and on some values such as, for example, secondary indicators like ADX or RSI, I want them to print out to the second output window in addition to the first. So the second output window might look like

          Print("Buy Signal at 8:30:00am)
          Print(ADX)
          Print(RSI)

          Comment


            #6
            Hello Boonfly8,

            I'm not quite understanding the issue.

            You do can exactly that. Set the PrintTo to OutputTab1, print the values, set the PrintTo to OutputTab2, print the values..

            Are you getting an error when changing the tab and printing the values again?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              what is the code to print to output 2?

              Print("hello world") prints to output 1... how can we make it print to output 2

              Comment


                #8
                Hello babouin77,

                You can find a sample for that in the help guide:

                JesseNinjaTrader Customer Service

                Comment


                  #9
                  i tried that but its not going to output 2

                  Comment


                    #10
                    Hello babouin77,

                    Did you try exactly as shown in the help guide and then remove and re add the script? Defaults require that you remove and re add the script for that change to be used.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      I am sorry what do i have to remove?

                      Comment


                        #12
                        Hello babouin77,

                        If you used the code in the help guide you would need to compile and then re apply the indicator. That involves removing it from the chart and then re adding it to the chart. Any code changes to State.SetDefaults require removing and re adding the script to see that change.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          ok when you say removing and re adding the script, what does that mean? all i copied is 1 lines and put them in my code...

                          PrintTo = PrintTo.OutputTab2;

                          so what exactly i need to remove from the script? im not following

                          Comment


                            #14
                            Hello babouin77,

                            That means to remove the script from where you have it applied and then re apply it.
                            JesseNinjaTrader Customer Service

                            Comment


                              #15
                              oh on the chart you mean.... ok ill try that

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by PaulMohn, Today, 12:36 PM
                              2 responses
                              16 views
                              0 likes
                              Last Post PaulMohn  
                              Started by Conceptzx, 10-11-2022, 06:38 AM
                              2 responses
                              53 views
                              0 likes
                              Last Post PhillT
                              by PhillT
                               
                              Started by Kaledus, Today, 01:29 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post Kaledus
                              by Kaledus
                               
                              Started by yertle, Yesterday, 08:38 AM
                              8 responses
                              37 views
                              0 likes
                              Last Post ryjoga
                              by ryjoga
                               
                              Started by rdtdale, Today, 01:02 PM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Working...
                              X