Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
New 5day or week high
Collapse
X
-
zachj, thanks for the post - the current day could be accessed per default via the CurrentDay.OHL indicator in NinjaScript - http://www.ninjatrader.com/support/h...nt_day_ohl.htm
For the current week, you would need to custom code a condition to keep track of it - this is not inbuild standard but on our suggestion list for potential future enhancement.
-
Would I do something like..
private double WeekHigh()
{
return (CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[0] && CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[1] && CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[2] ........)
}
private void WeekHighMethod()
{
if (Close[0] > WeekHigh())
{EnterLong()}
}
I think putting the PriorHigh[1] sends it back 2 days? And PriorHigh[2] is 3 days back.
Comment
-
zachj, the index you apply would be based on the bars, so would not refer to 1 / 2 days back but literally the bars of the series you're working on.
To track you can start working for example with this snippet, it would reset the track on Monday for the new week -
if (Time[0].DayOfWeek == DayOfWeek.Monday && Bars.SessionBreak)
trackCurrHigh = High[0];
if (High[0] > trackCurrHigh)
trackCurrHigh = High[0];
Comment
-
I'm not understanding what that is doing and don't see anything in the manual about trackCurrHigh?
I guess that is picking up the high starting from monday but that will do we no good if it's wed im trying to look back 5 trading days. I can't believe there is no way to have it recognize the day high say 3days back.
What about creating and index 1
Add(PeriodType.Day, 5); This would make a 5day bar I think.
{
if (Close[0] > Highs[1][0])
{EnterLong()}
}
Comment
-
So when I add Index 1 as mentioned below, a 5day bar, what is the primary bar set at where can I see this or adjust the primary? Will it just be whatever chart time period I have pulled up, say I have a 5minute chart up. Or is this controllable in the backtest area? I wasn't quite understanding that from the manual.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
656 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment