Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Referencing Previous Instance(s) Of Condition
Collapse
X
-
Countif for Multiple Timeframe Strategies
I've noticed in the help that the Countif function (as well as MRO/LRO functions) is caveated in that it will not work with multiple instruments or timeframes. Is this still the case, and if so, do you offer an alternative approach? Converting boolean expressions to doubles, setting these 1/0 values to a dataseries and then using the SUM function on this dataseries to count the occurances didn't work as expected.
Regards,
Whitmark
Comment
-
For clarification, consider the following example where Low[0] and Close[0] are from an hourly series (BarsInProgress = 0) and user defined variable YestDailyLow is assigned during a Daily series bar close event (BarsInProgress = 1). One would think the way to invoke a CountIf would be:
Code:If (BarsInProgress == 0) { myCond = CountIF( delegate (return Low[0] <= YestDailyLow && Close[0] >= YestDailyLow;), 5) > 2); }
Code:If (BarsInProgress == 0) { myCond = CountIF( delegate (return Low[0] <= YestDailyLowSeries[0] && Close[0] >= YestDailyLowSeries[0] ;), 5) > 2); }
Regards,
Whitmark
Comment
-
Okay, but do I get points for trying? I'll cry "uncle" and use the brute force method below:
Code:if (BarsInProgress == 0) { YestDailyLowSeries.Set( YestDailyLow ); int count = 0; for ( int i = 0, i < 5 && CurrentBar - 5 >= 0; i++ ) { if ( Low[i] <= YestDailyLowSeries[i] && Close[i] >= YestDailyLowSeries[i] ) Count++; } myCond = count > 2;
Regards,
WhitmarkLast edited by whitmark; 08-01-2007, 03:50 PM.
Comment
-
Any alternatives/workaround for this countif in multitimeframe
Ray,
Looking at Marks' post and your reply now....So what are the options for countif where multitimeframe is involved?. Can you pls suggest some alternatives if that means coding in c# thats fine..But I just need some ideas so that I can get the function created in C#.
Thanks.
Cheers,Padhu
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by f.saeidi, Today, 12:12 AM
|
0 responses
3 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
||
Started by Conall, Today, 12:06 AM
|
0 responses
5 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
||
Started by proptradingshop, 03-21-2024, 09:50 AM
|
6 responses
27 views
0 likes
|
Last Post Today, 12:02 AM | ||
Started by mly916, Yesterday, 09:48 PM
|
1 response
12 views
0 likes
|
Last Post Yesterday, 11:54 PM | ||
Started by Mikey_, Yesterday, 09:21 PM
|
0 responses
11 views
0 likes
|
Last Post
by Mikey_
Yesterday, 09:21 PM
|
Comment