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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
156 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
90 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
138 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
130 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment