Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Divergence logic
Collapse
X
-
I have found max price using
double maxHigh = MAX(StochasticsFast(3, 14).D, 5)[0];
But i dont know how to identify higher and lower peak of the last 5 bars. For first peak stoch reading has to move upwards then downwards and for second peak is the same process
Comment
-
I created seriesmaxHigh1 to track
maxHigh1[0] = MAX(StochasticsFast(3, 14).D, 5)[0];
maxHigh2[0] = MAX(StochasticsFast(3, 14).D, 5)[0];
and i am stuck with the condition.. dont know how to proceed to identify rising and lowering peak. I need to look back 2 periods and to look forward 2 periods
if (maxHigh1[1] > 80 && maxHigh1[2] < maxHigh1[1] && maxHigh1[3] < maxHigh1[2])Last edited by tkaboris; 06-23-2023, 09:34 AM.
Comment
-
All i am doing is collecting highest in the last 5 bars when its above 80. I now need to collect those values and determine the highest peak.
region Find Peak
if (maxHigh1[1] > 80 && maxHigh1[0] > maxHigh1[2] )
{
pivotHigh = true;
Print("maxHigh1[1]" + maxHigh1[1] );
}
else if (maxHigh1[1] < 80)
{
pivotHigh = false;
}
Print(pivotHigh + " Currentbar: " + CurrentBar);
#endregion
Comment
-
Hello tkaboris,
You would have to come up with your own logic to look for that based on some criteria. If both of those highs are within the same period and the second high is less than the first that wouldn't be considered a high, that would be an ignored lesser value when using any of the existing methods to check for highest bars/max values. If the indicator has a fixed scale value you could potentially check if the price is greater than X and store those prices in a list or array. Because that is infrequent and not on every bar you wouldn't be able to store those values in a Series<double> and then pass that to an indicator, indicators work based on continuous input data. You would have to do your own math logic based on your list or array of values.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
90 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
137 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
120 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
69 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment