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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    89 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X