Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Print something just once in OnbarUpdate

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

    How to Print something just once in OnbarUpdate

    I have something where if the trade makes $100, it will return to the onBarUpdate method and essentially quit. In the same if statement I also print the time and some text like "Pnl Target Hit".

    How do I only print that once? when the pnl hits I don't want it to keep printing via every onBarUpdate. Is there a system.exit function in NT8?

    #2
    Hello Boonfly8,

    You would need to control this in the logic of the script. I would recommend using a bool (that can be flipped back to true on a new bar on bar close or on the first tick of a new bar)

    Below is a public link to an educational site that demonstrates using a bool.
    https://www.dotnetperls.com/bool
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Ericawin, Today, 11:57 PM
    0 responses
    1 view
    0 likes
    Last Post Ericawin  
    Started by trvalst, Today, 11:38 PM
    0 responses
    2 views
    0 likes
    Last Post trvalst
    by trvalst
     
    Started by Rainmakersg, Today, 11:38 PM
    0 responses
    3 views
    0 likes
    Last Post Rainmakersg  
    Started by trvalst, Today, 11:38 PM
    0 responses
    2 views
    0 likes
    Last Post trvalst
    by trvalst
     
    Started by hmgukophgqwd, Today, 11:11 PM
    0 responses
    8 views
    0 likes
    Last Post hmgukophgqwd  
    Working...
    X