Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question with ninjascript strategy

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

    Question with ninjascript strategy

    While making a new ninjascript strategy, in the conditions and actions set section, I set up certain conditions that result in the action of entering a trade as well as setting variable0 = 1. When a position is not open variable0 = 0. I also set up a condition when variable0 == 1 and when the time series 0 bars ago == the time series 96 bars ago, the action taken is closing any open positions. I thought this would result in closing of any open positions after 96 bars have passed. However while backtesting, this does not seem to be the case, as i have one trade that went over 300 bars. How do I go about setting up a condition and action set that results in any open positions being closed after 96 bars?

    #2
    In NT6.5 we exposed a BarsSinceEntry(), you could try checking if this is > 96 and if yes, exit a position.
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    287 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    180 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    178 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    263 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    216 views
    0 likes
    Last Post CarlTrading  
    Working...
    X