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 NullPointStrategies, Today, 05:17 AM
    0 responses
    41 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X