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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    65 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    35 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    59 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Working...
    X