Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help to close Position on Next Bar Close

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

    Help to close Position on Next Bar Close

    Hello,

    I am running the strategy in daily mode and the take profit is at 21EMA at close of the third day, but I can only get the third day open prices. Can you help advise?

    if(High[0]>EMA(21)[1])
    {
    ExitLongLimit(GetCurrentBid());

    }

    if (BarsSinceEntry()>2)
    {
    ExitLong();
    Print(BarsSinceEntry());
    ///ExitOnClose=true;
    ///ExitOnCloseSeconds = 30;
    }

    Rgds,
    Sgtrader

    #2
    Hi Sgtrader and welcome to our forums - this would unfortunately not be possible using daily data only. You would need to add intraday granularity here to be able simulate this condition.

    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X