Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reset EMA on new trading day

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

    Reset EMA on new trading day

    Hello

    I have an strategy that determines the trend with two EMAs. Sometimes there is a big gap from friday to Monday, and I would like to be able to reset EMA at the start of every trading day. Any idea or example how can I do that?

    Thanks a lot

    #2
    Hello Impeesa,

    There is not any way to do that with the standard EMA because it calculates based on the period you supplied. You would essentially have to call the EMA with a period that is less than the bars ago from the current trading day and increase the period for each new bar until you reach your target period. The other way would be to make a copy of the EMA and edit its code to support using IsFirstBarOfSession to do the same task of changing the period used to either the amount of bars since the session start or the period whichever is less.

    Comment

    Latest Posts

    Collapse

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