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

Print()-how to limit output lines printed...

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

    Print()-how to limit output lines printed...

    Hi,
    Here's what I have inside OnBarUpdate():

    ............
    prevLow = ll;

    CrsAbv20 = CrossAbove(Stochastics(PeriodD, PeriodK, Smooth), 21, 1); // 22

    if (CrsAbv20)
    {
    ll = MIN(Low, 20)[0]; // lowest low
    prevLow = ll;
    DrawArrowUp("UpArrow" + CurrentBar, true, 1, (ll-arrowPos), Color.Lime);

    Print("Above LL = "+ll+ "... prevLow = " +prevLow+ " --- Time:......"+DateTime.Now);
    }
    ...........

    It prints number of lines, maybe 50 or so... I do not understand why? How to limit the output to a single line as expected please? I'm getting a single arrow at cross above and expected to see only one line of output instead of many.
    I also try to remember prev. arrow low into prevLow variable. In the output the first line seems gets me correct values-prevlow is the low of my prev arrow, current low is printing correctly... etc... But the rest of lines in output has diff/incorrect values for prevLow. Did I misunderstand smth about cross above and print? Why I see many lines in output instead of a single line please and how to fix it?
    Thank you very much.
    Regards, Art.

    #2
    Hello Art,

    You'll probably want to check the state of CrsAbv20.

    Print(CrsAbv20);

    It doesn't look like there's any logic there to set to false. It may be cleaner to write:

    if (CrossAbove(Stochastics(PeriodD, PeriodK, Smooth), 21, 1))
    {
    ll = MIN(Low, 20)[0]; // lowest low
    prevLow = ll;
    DrawArrowUp("UpArrow" + CurrentBar, true, 1, (ll-arrowPos), Color.Lime);

    Print("Above LL = "+ll+ "... prevLow = " +prevLow+ " --- Time:......"+DateTime.Now);
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much! How could I not see this? Sometimes all it needs a fresh look. Thank you.

      Comment


        #4
        Hi,
        Unfortunately the problem is still there. I change the code as suggested by you but still getting bunch of messages per single arrow:
        ......
        if (CrossAbove(Stochastics(PeriodD, PeriodK, Smooth), 21, 1)) //(CrsAbv20)
        {
        ll = MIN(Low, 20)[0];
        prevLow = ll;
        DrawArrowUp("MyUpArrow" + CurrentBar, true, 1, (ll-arrowPos), Color.Lime);
        Print("Above LL = "+ll+ "... ArrowBarLow = " +ArrowBarLow + "... prevLow = " +prevLow+ " --- Time:......"+DateTime.Now);

        CrsAbv20 = false; // tried this too - does not fix the problem
        }
        .....
        Above LL = 1.3616... prevLow = 1.3616... --- Time:......11/15/2010 10:04:04 AM
        Above LL = 1.3616... prevLow = 1.3616... --- Time:......11/15/2010 10:04:04 AM
        Above LL = 1.3616... prevLow = 1.3616... --- Time:......11/15/2010 10:04:04 AM
        Above LL = 1.3616... prevLow = 1.3616... --- Time:......11/15/2010 10:04:04 AM
        Above LL = 1.3616... prevLow = 1.3616... --- Time:......11/15/2010 10:04:04 AM
        Above LL = 1.3616... prevLow = 1.3616... --- Time:......11/15/2010 10:04:04 AM
        ..............
        .........
        .........


        Thank you very much.
        Regards, Art.
        Last edited by Art09; 11-15-2010, 09:04 AM.

        Comment


          #5
          Hello Art,

          You might want to clean up your charts so you can verify only instance of this indicator is currently applied. Close all workspaces except one. File > Workspace > Close Workspace.

          Close all but one chart, and verify only one indicator is applied.

          You will also see continuing output if running with CalculateOnBarClose = false. Conditions are evaluated with every incoming tick, and not just on bar close.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Done what you've suggested, but it did not help. The problem is still there.
            .....................
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:47 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:47 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:47 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:47 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:47 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:47 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:47 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:48 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:48 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:48 AM
            Above LL = 1.3577... prevLow = 1.3577 --- Time:......11/15/2010 11:06:48 AM
            ...............
            ..............
            .............
            I'm using only Default workspace and closed all the charts and there is only one indicator.
            Thank you.

            Comment


              #7
              Art09,

              Please share the whole script you're using and I'll try on my end. Should be a .cs file in My Documents\NinjaTrader 7\bin\custom\indicator
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Hi,
                I will forward the script via email with attn to you.
                Thank you.
                Last edited by Art09; 11-15-2010, 10:37 AM.

                Comment


                  #9
                  Thanks, Art.

                  I took a look at the script and see similar output. What you are doing is printing the time of your PC clock each time the condition is true, and the script runs through all bars very fast. If you want to reference the time stamp of bars instead, you can use:

                  Print("Above LL = "+ll+ "... ArrowBarLow = " +ArrowBarLow + "... prevLow = " +prevLow+ " --- Time:......"+ Time[0]);
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Thank you very much!
                    I understand this does not correlate with my other problem - Double arrow @ CrossAbv/Blw problem - http://www.ninjatrader.com/support/f...ad.php?t=35559.
                    Thank you again.

                    Comment


                      #11
                      Hi,
                      Unfortunatelly I'm still gettin bunch of messages per cross/arrow.
                      Thank you, Art.

                      Comment


                        #12
                        Art, we'll reply in the appropriate thread for the issue - thanks for the patience.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          This is the one I opened for this issue. What's the appr. thread? What does it mean you will reply to appr thread? At least send me a link to appr thread if the one I opened and get replies is not appr for some unknown reason.
                          Thanks.

                          Comment


                            #14
                            Art,

                            We want to avoid situations where we're talking about the same code snippet in multiple threads. We also need to work on one issue at a time.

                            If you're looking for professsional debugging help, please consider hiring a 3rd party NinjaScript consultant:
                            Ryan M.NinjaTrader Customer Service

                            Comment


                              #15
                              This is strange, softly speaking... But this is the Ninja issue, not some custom methods or such. There is a problem with CrossAbove/Below() + Print() methods which are Ninja supplied methods. What 3rd party has to do with all this?
                              How can I take this matter further please? Is there level 2 support, how can I reach it please?
                              Thanks.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by sightcareclickhere, Today, 01:55 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post sightcareclickhere  
                              Started by Mindset, 05-06-2023, 09:03 PM
                              9 responses
                              258 views
                              0 likes
                              Last Post ender_wiggum  
                              Started by Mizzouman1, Today, 07:35 AM
                              4 responses
                              18 views
                              0 likes
                              Last Post Mizzouman1  
                              Started by philmg, Today, 01:17 PM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by cre8able, Today, 01:01 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X