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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    132 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X