Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
distance between 2 EMAs
Collapse
X
-
distance between 2 EMAs
Hello. Trying to restrict trades from entering if the 21 is too far from the 50. Or could be worded the other way. Only enter trade if the 21 is within a certain amount of ticks from the 50. Either way. Can it be done on the strategy builder? Thank youTags: None
-
Hi Touch-Ups, thanks for posting. You would need to be able to do some math operations on the value of each EMA object, so unfortunately that would not be possible in the builder. You would need to check:
Code:if(Math.Abs((EMA(21)[0]-EMA(50)[0])/Bars.Instrument.MasterInstrument.TickSize) > SomeTickValue) {}
Kind regards,
-ChrisL
-
Well... I ran across EMAticksaway indicator from here:
Hello, I have been looking through the huge list of indicators to see if I can find one that measures the distance from EMA to the current candle. For example, it asks for what EMA you want let's say EMA13 for starters, and then it would always tell you how man ticks away from that EMA the closest part of the current candle is.
It would be perfect, but I can not get it to work in the strategy analyzer. I don't get any errors. It just will not allow any trades when I run it.
Comment
-
You can work with the distance between moving averages in the strategy builder. It requires using the "offset" for the math of subtracting one from the other and it would require using the "points" instead of a tick reference.
I've attached an example using the MES 12-22, which has 4 ticks per point. In the example I created the conditions to look for a spread of less than or equal to +/- 1 (4 ticks) and when true to color the background. You use the +/- because sometimes one moving average is above or below the other. As you can see it is showing correct functionality.
Here is a link to the strategy builder help guide on Offset: https://ninjatrader.com/support/help...setAnItemValue
It would also be possible to convert to ticks however it is more complex and involves storing values in custom series in the strategy builder.
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mlarocco, 06-20-2025, 11:12 AM
|
1 response
46 views
0 likes
|
Last Post
|
||
Started by futurenow, 12-06-2021, 05:49 PM
|
19 responses
1,025 views
0 likes
|
Last Post
![]()
by Redders
06-16-2025, 06:02 AM
|
||
Started by mathfrick2023, 05-08-2025, 12:51 PM
|
8 responses
139 views
0 likes
|
Last Post
![]()
by Yogaman
06-14-2025, 06:01 PM
|
||
Started by several, 04-22-2025, 05:21 AM
|
1 response
296 views
0 likes
|
Last Post
![]()
by Lukasxgtx
06-13-2025, 06:00 AM
|
||
Started by NTEducationTeam, 06-12-2025, 02:30 PM
|
0 responses
54 views
0 likes
|
Last Post
![]() |
Comment