Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Entering Position before moving averages cross
Collapse
X
-
Entering Position before moving averages cross
How do I create a condition for entering a position when two moving averages are 5 ticks or less from each other?Tags: None
-
Hello tpearson00,
Thank you for your post.
You can either subtract the value of one moving average from the other and check if this is less than 5 ticks. Both code examples below do the same thing:
orCode:if (Math.Abs(EMA1[0] - EMA2[0]) < 5 * TickSize)
Code:if (Math.Abs(EMA1[0] - EMA2[0]) * TickSize < 5)
Multiplying by the tick size converts it to the value in ticks.
Please let me know if you have any other questions.
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
70 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
143 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
76 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
47 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
51 views
0 likes
|
Last Post
|

Comment