Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit trade after x bars

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

    Exit trade after x bars

    I would just like the strategy to exit after x bars. I'm trying to use BarsSinceEntryExecution(), but I don't know where it goes in the code, or the arguments the function takes. The NinjaTrader 8 tutorials don't do a great job explaining how to use NinjaScript. Any help is highly appreciated.

    #2
    Hello Lumbeezl,

    Thank you for your note.

    I have attached 2 strategies which both use BarsSinceEntryExecution. One was written in the builder and one was written in the editor. The one written in the builder, MyCustomStrategy11, on the conditions and actions page, at the bottom you should click on Set2 for how this is used.

    See the following section of our helpguide,


    To Import a NinjaScript into NinjaTrader 8 do the following:
    From the Control Center window select Tools -> Import-> NinjaScript...
    Find the file location.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    29 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    46 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X