Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Find Max ammounts bars when close is above 10 ema line
Collapse
X
-
Originally posted by NinjaTrader_Bertrand View Postwallsteetking, would suggest doing the plot outside the condition then resetting the count to 0 if you see a close below the EMA simply.
if (Close[0] > EMA(10)[0])
Counter++;
else
Counter = 0;
Plot0.Set(Counter++);Code:Plot0.Set(Counter);
Leave a comment:
-
Thank you NinjaTrader_Bertrand this is what i was looking for.
Leave a comment:
-
wallsteetking, would suggest doing the plot outside the condition then resetting the count to 0 if you see a close below the EMA simply.
if (Close[0] > EMA(10)[0])
Counter++;
else
Counter = 0;
Plot0.Set(Counter);Last edited by NinjaTrader_Bertrand; 09-08-2014, 02:19 AM.
Leave a comment:
-
-
Hello Wallsteetking,
Thank you for your post.
This formula starts to subtract when it fails this criteria
I'm not sure what you mean by this. The CountIf() should maintain the same usage throughout the code.
If you want to make it an infinite amount you can use CurrentBar in place of 20, however I would not recommend this unless you plan on ignoring the historical in the beginning, Otherwise, it will cause huge delays and lag in the chart.
My recommendation instead would be to check when the Close is higher than the EMA(10) and then store a counter value
if(Close[0] > EMA(10)[0])
counter++;
let me know if I can be of further assistance.
Leave a comment:
-
Find Max ammounts bars when close is above 10 ema line
Hello Ninjatrader Team,
how can I tell Ninjatrader ( in indicator mode) to tell me what was the Max amount of bars back when the close was higher than the 10 EMA line starting from today going backwards.
I found this formula online but it not exactly correct.
Code:int NumBullishCandle = CountIf(delegate {return Close[0] > EMA(10)[0];}, 20); Plot0.Set(NumBullishCandle);
Also its going to be important to have it in Plot mode. Not print.
Thank you
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ntsomeone, Today, 07:47 AM
|
0 responses
6 views
0 likes
|
Last Post
by ntsomeone
Today, 07:47 AM
|
||
Started by RJBen, 01-24-2025, 02:39 PM
|
2 responses
11 views
0 likes
|
Last Post
by RJBen
Today, 07:35 AM
|
||
Started by ilaniko, Today, 06:22 AM
|
0 responses
9 views
0 likes
|
Last Post
by ilaniko
Today, 06:22 AM
|
||
Started by GeorgeW, 01-12-2025, 11:59 AM
|
4 responses
46 views
0 likes
|
Last Post
by GeorgeW
Today, 02:43 AM
|
||
Started by CBCharts, Yesterday, 09:35 PM
|
0 responses
9 views
0 likes
|
Last Post
by CBCharts
Yesterday, 09:35 PM
|
Leave a comment: