NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06-29-2011, 02:42 PM   #31
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Not sure I follow. You don't actually need to create an array just to be able to inject that into your nom/dem calculations.

You already have the basis down for all the historical dates for nom/dem. So all you need to do now is before you do any of the historical dates, you want to do the current date first.

Assuming BarsInProgress == 0 is a 1min series and session closes at 2PM (aka 140000).
Code:
if (BarsInProgress == 0)
{
     if (ToTime(Time[0]) == 135900)
     {
          ArrayList nom = new ArrayList();
          nom.Add(Close[0] - Math.Min(MIN(Lows[dailyBars], k-1)[0], CurrentDayOHL().CurrentLow[0]));
          x=0;
          while (x < d)
          {
               nom.Add(Closes[dailyBars][x] - MIN(Lows[dailyBars],k)[x]);
               x++;
          }

          // denoms
          ArrayList den = new ArrayList();
          den.Add(Math.Max(MAX(Highs[dailyBars], k-1)[0], CurrentDayOHL().CurrentHigh[0]) - Math.Min(MIN(Lows[dailyBars], k-1)[0], CurrentDayOHL().CurrentLow[0]));
          x=0;
          while (x < d)
          {
               den.Add(MAX(Highs[dailyBars],k)[x] -  MIN(Lows[dailyBars],k)[x]);
               x++;
          }
          ...
          ...
     }
}
Now you will have to play around with the idea here as I have not tested it, but it should give you a framework as to where to go. Above shows an example of adding the current day's info into the first [0] index and then adding all the historical stuff after it so you can access the ArrayList in proper chronological order.
NinjaTrader_Josh is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Josh for this post:
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:55 AM.