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.
    Test the bool type, which holds true or false. A bool occupies 1 byte of memory.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    5 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    12 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,982 views
    3 likes
    Last Post jhudas88  
    Working...
    X