Announcement

Collapse
No announcement yet.

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.
      https://ninjatrader.com/support/help...dataseries.htm
      https://ninjatrader.com/support/help.../barsarray.htm
      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 manueldecastro, Today, 01:37 AM
        0 responses
        3 views
        0 likes
        Last Post manueldecastro  
        Started by memonolog, Today, 01:29 AM
        0 responses
        2 views
        0 likes
        Last Post memonolog  
        Started by BennyNewtony, Today, 12:13 AM
        0 responses
        4 views
        0 likes
        Last Post BennyNewtony  
        Started by thgeenlifesd, Today, 12:13 AM
        0 responses
        8 views
        0 likes
        Last Post thgeenlifesd  
        Started by thgeenlifesd, Today, 12:10 AM
        0 responses
        3 views
        0 likes
        Last Post thgeenlifesd  
        Working...
        X