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 charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
60 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
148 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
98 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
286 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment