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 fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,403 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    94 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    6 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    158 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    8 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X