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, 05-11-2026, 05:56 AM
    0 responses
    58 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    195 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    361 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    281 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X