Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

exit position if after X amount of seconds and Y amount of profit

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

    exit position if after X amount of seconds and Y amount of profit

    my 35 second strategy is dialed in except for one part. the open of the market for the first 2 minutes i get profit but it happens really fast and it goes back down to the exit (a bollinger line) that works great for when the market is behaving is it normally does during the day. is there a way to have a condition that says close greater or equal to position average price + X amount of ticks as One. And, as the Second condition - a time condition that says if less than or equal to 5 seconds from time of entry.

    #2
    Hello SteveReiza,

    Thanks for your post.

    A condition could be created in the Strategy Builder that checks if the Close price (Price folder > Close) is greater than or equal to the Average Position Price (Strategy folder > Average position price) offset by a set number of ticks.

    See this help guide page which contains information about offsetting a value: https://ninjatrader.com/support/help...on_builder.htm

    The Strategy Builder Time Comparison conditions do not have the option to specify a set number of seconds, only the hours and minutes can be set.

    You would need to save the Time[0] to a DateTime variable when the entry order is submitted and then use C# DateTime objects to create your condition in an unlocked script.

    Time[0]: https://ninjatrader.com/support/help...eries_time.htm

    Manipulating DateTime Objects Reference Sample: https://ninjatrader.com/support/help...me_objects.htm

    For more information about C# DateTime, you could do a Google search for something like "working with C# DateTime".

    Here is the publicly available C# Microsoft documentation on DateTime: https://learn.microsoft.com/en-us/do...e?view=net-8.0
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      thanks for the reply. okay sweet. that's cool. i don't want to unlock the code, so i'll make due. i have a stop limit order on a smaller tick timeframe within that minute when market open with a bollinger line. i think it will catch it where it needs to for a profit capture.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      48 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      66 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X