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

prior day close price

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

    prior day close price

    Hi,
    Currently I am getting prior day close price from priordayOHLC indicator due to FXCM as my data provider, as they don't provide last day close price. But using priordayOHLC, does not allow me to use the value in a daily or higher time frame chart. Is there any other way I could get prior day close price to calculate and use it in my ninjascirpt code? thanks in advance.

    #2
    Hi asmmbillah,
    I'm not sure, I understand the issue with your data feed. You shouldn't need a separate indicator to determine prior day data.
    I assume, you get market data for the entire session, be it as 1 min bars or greater.

    To grab the close of the day before, just check on OnBarUpdate if the date of the bar is different from the date of the bar before.
    If Yes, you have a day break in between and it just happened.

    if (Times[1][0].Date != Times[1][1].Date) // true once a day when the first bar of the new day closes.
    {
    myYesterdayClose = Closes[1][1]; // goes back one bar = yesterday and grabs the close of such session.

    You can also use IsFirstBarOfSession logic to identify the bar from which to go back one bar to grab the prior day close.

    NT-Roland

    Comment


      #3
      Hello asmmbillah,

      NT-Roland is suggesting that if the primary series is a daily series, High[1] would be the high of 1 bar ago, or 1 day ago.

      If this is not achieving the goal, for reasons like applying a custom trading hours template, it is possible to add a minute series to the script with AddDataSeries and use this for the input series of the PriorDayOHLC indicator.

      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        thanks everyone. I have replace priordayohlc close with adding add data series of daily bartype with period 1 and getting Closes[1][1]. That solved my issue. thanks again.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cre8able, Today, 03:20 PM
        1 response
        9 views
        0 likes
        Last Post cre8able  
        Started by fiddich, Today, 05:25 PM
        0 responses
        3 views
        0 likes
        Last Post fiddich
        by fiddich
         
        Started by gemify, 11-11-2022, 11:52 AM
        6 responses
        804 views
        2 likes
        Last Post ultls
        by ultls
         
        Started by ScottWalsh, Today, 04:52 PM
        0 responses
        4 views
        0 likes
        Last Post ScottWalsh  
        Started by ScottWalsh, Today, 04:29 PM
        0 responses
        9 views
        0 likes
        Last Post ScottWalsh  
        Working...
        X