minfound = MIN(Low, Swing1.SwingHighBar(Strength, 1, CurrentBar) - Strength - 1)[Strength + 1];
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to find bar at which MIN occurs?
Collapse
X
-
How to find bar at which MIN occurs?
This equation finds a minimum value. What code can i write to return the bar number? Thanks!
minfound = MIN(Low, Swing1.SwingHighBar(Strength, 1, CurrentBar) - Strength - 1)[Strength + 1];
Tags: None
-
It tried the The LowestBar method. And that is the right idea. But it starts the search for lowest bar at current bar But i need it to start the search Strength bars ago, not on [0] bar. problem is LowestBar[Strength] is not possible. How can a person express this idea int lowestBar = LowestBar(Low, x)[Strength]? thanks!
-
Thank you ChelseaB:
I was intimidated by the complexity involved with that solution (maybe because i am new to this). But i came up with this alternate method that finds the minimum value and minimum bar number with one loop on OnBarUpdate. Let me know if you see a problem with that. thanks!
protected override void OnBarUpdate()
{
//Kicks.Spin alternate logic for minbarnumber & minvalue not including previous 2 bars
barsback = 5;
startsearchbar = CurrentBar - 5;
minbarnumber = startsearchbar;
minvalue = Low[CurrentBar - minbarnumber];
for(int i = startsearchbar + 1; i < CurrentBar - 2; ++i)
{
if(Low[CurrentBar - i] < minvalue)
{
minbarnumber = i;
minvalue = Low[CurrentBar - i];
}
}
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
45 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
21 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
31 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
50 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment