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 NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
56 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
132 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
73 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|

Comment