Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

calculate on each tick AND exit after x bars

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

    calculate on each tick AND exit after x bars

    Hi, I'm working with a script that places a limit order below the prior candle's high if that high is touched or breached, so I needed to use "calculate on each tick" for that to work, but I also want to close the trade after 1 bar, but this seems to conflict with "on each tick" (the trade closes after 1 tick instead of after 1 bar). Is there a method I can use to close a trade after 1 bar even though my strat is working on ticks?
    thanks,
    David

    #2
    Hello trader3000a,

    Thank you for your post.

    For that, you can use BarsSinceEntryExecution() to check that 1 bar has elapsed prior to sending an exit order:



    For example:

    if (BarsSinceEntryExecution() == 1)
    {
    ExitLong();
    }

    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

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