Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Print

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

    Stop Print

    Hello,

    is somehow possible to stop Print when condition is true? My goal is to reduce Print statements.

    Thank you.

    #2
    Hello emuns,

    This would be up to the logic your script.

    If the condition is true, do not call Print() in the code.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      that´s the problem. I need to use: when condition is true - Print something. But than I need something like: when condition change stop printing or print just x rows etc.
      If I understand it correctly, nothing like this can be used, so I have to deal with the situation on condition itself...?

      Thank you
      Last edited by emuns; 02-21-2020, 08:54 AM.

      Comment


        #4
        Hello emuns,

        Right, you would need to deal with this in your logic if you want to stop the print.

        As long as you are calling the Print command it will happen. If that should be reduced or not happen you would need to call it less or not at all. You could add variables or other logic to control that better if you want but that is going to be up to your logic.

        If you are trying to only see a print when the condition changes or want to control it based on condition changes you might be able to do that using a bool:




        Code:
        private bool printOnce = false;
        protected override void OnBarUpdate()
        {
            if(CrossAbove(SMA(12), SMA(16), 1))
            {
                printOnce = true;
            }
            else if(CrossBelow(SMA(12), SMA(16), 1))
            {
                printOnce = true;
            }
            if(printOnce == true)
            {
                Print("Print one time because one of the conditions was true");
                printOnce = false;
            }
        }

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        574 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        333 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X