![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
|
|
Thread Tools | Display Modes |
|
|
#31 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
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++;
}
...
...
}
}
Josh
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Josh for this post: |
|
| Thread Tools | |
| Display Modes | |
|
|