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 rocketman7, Today, 01:00 AM
    0 responses
    1 view
    0 likes
    Last Post rocketman7  
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    27 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 04-23-2024, 09:53 PM
    2 responses
    74 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    193 views
    0 likes
    Last Post Hasadafa  
    Working...
    X