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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X