Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
to check if condition occured in lat 8 bars
Collapse
X
-
First, you could shorten some of your code:
From (Close[2] > Open[2] || Close[2] < Open[2])
To Close[2] != Open[2]
And from (Close[0] > Open[0] || Close[0] < Open[0])
To Close[0] != Open[0]
Then you might need to modify Math.Abs(Low[0] - High[2]) >= 2)
To Math.Abs(Low[0] - High[2]) >= 2*TickSize) if that is what you actually wanted.
Then you could use a bool series: private Series<bool> ImbalanceLongSeries;
When you test imbalanceLongHTF = true; you can store it in the series ImbalanceLongSeries[0] = true;
Ex.
if(imbalanceLongHTF)
ImbalanceLongSeries[0] = true;
else
ImbalanceLongSeries[0] = false;
Then loop through the last 6 bars to check for any true condition.
-
to check if condition occured in lat 8 bars
HI i have a condition below that evaluates a imbalanceLongHTF condition to true. How can i add aditional logic to determine if imbalanceLongHTF occured in the last 6 bars?
if(((Close[2] > Open[2] || Close[2] < Open[2])
&& Close[1] > Open[1] && (Close[0] > Open[0] || Close[0] < Open[0])) &&
Low[0] > High[2] && (Math.Abs(Low[0] - High[2]) >= 2))
{
longimbalanceHTFTopLevel = Low[0];
longimbalanceHTFBotLevel = High[2];
imbalanceLongHTF = true;
}Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by samish18, Today, 09:30 PM
|
0 responses
3 views
0 likes
|
Last Post
![]()
by samish18
Today, 09:30 PM
|
||
Started by Super Bardock, Yesterday, 11:52 AM
|
2 responses
18 views
0 likes
|
Last Post
![]() |
||
Started by raysinred, 04-06-2025, 01:52 PM
|
16 responses
139 views
0 likes
|
Last Post
![]()
by raysinred
Today, 08:35 PM
|
||
Started by iantriestrading, Yesterday, 01:39 PM
|
5 responses
28 views
0 likes
|
Last Post
![]() |
||
Started by trendisyourfriend, 05-25-2023, 09:54 AM
|
10 responses
170 views
0 likes
|
Last Post
![]()
by Curerious
Today, 05:57 PM
|
Leave a comment: