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 Hwop38, 05-04-2026, 07:02 PM
|
0 responses
175 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
331 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
253 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
356 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
183 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment