Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Display 2 days on one chart

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

    Display 2 days on one chart

    Hello
    I wish to display current EMA and yesterday EMA for the same time period.

    EMA(int period)[int barsAgo]
    EMA(ISeries<double> input, int period)[int barsAgo]

    If I have a 5 minute bar, I have 288 in a day. barsAgo =288 except it doesn't work on Monday.

    The magic is to calculate barsAgo for for same time previous trading day. Holidays make it dicy too.

    Ideas, suggestions?

    Thanks



    Morris

    #2
    Hello morrnel,

    That would require some logic to do, as you mentioned there would be some items to account for like holidays. You could use the GetBar method which takes a time. The time could be Time[0] minus a day.



    A barsago value is returned if the bar is found. This would be where some logic would be needed to make sure a positive bars ago was found.

    You would could then use the BarsAgo with the EMA.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Haiasi, 04-25-2024, 06:53 PM
    2 responses
    17 views
    0 likes
    Last Post Massinisa  
    Started by Creamers, Today, 05:32 AM
    0 responses
    5 views
    0 likes
    Last Post Creamers  
    Started by Segwin, 05-07-2018, 02:15 PM
    12 responses
    1,786 views
    0 likes
    Last Post Leafcutter  
    Started by poplagelu, Today, 05:00 AM
    0 responses
    3 views
    0 likes
    Last Post poplagelu  
    Started by fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,407 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Working...
    X