Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entering Position before moving averages cross

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    #2
    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:


    Code:
    if (Math.Abs(EMA1[0] - EMA2[0]) < 5 * TickSize)
    or

    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.

    Comment


      #3
      Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      70 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      143 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      76 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      47 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      51 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X