I want to find, on an intraday chart, the lowest and highest prices of the last n days not including today's session
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Lowest/highest prices n days back
Collapse
X
-
You can Add() a Daily bar to your chart and use that as the data series
As long as you're running this on COBC = true, it will exclude today's session and look back on the past 3 bars for the daily series.Code:protected override void Initialize() { Add(PeriodType.Day, 1); } protected override void OnBarUpdate() { if(CurrentBars[1] < 0 || CurrentBars[0] < 1) return; double highest = MAX(BarsArray[1], 3)[0]; double lowest = MIN(BarsArray[1], 3)[0]; Print("The Highest Price of the last 3 days was : " + highest); Print("The Lowest Price of the last 3 days was : " + lowest); }MatthewNinjaTrader Product Management
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
331 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
550 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment