fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Help understanding Candle ID when creating MA Crossover EA

    Questions & Answers
    2
    3
    1685
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      richreed2426 last edited by

      Hi, When creating a MA Crossover EA I am finding that if I leave the candle ID as zero on the condition for the crossover then when I test I am finding the EA doesn't Buy/Sell on every crossover. It does however work when I put the candle ID as 1. I understand that candle ID 1 refers to the next candle after the crossover which is fine but I don't understand why I get mixed results when I want the EA to execute the trade on the present candle when the crossover happens. If I move the 'once per bar' below the condition then sometimes it executes the trade twice on consecutive candles. I think I am misunderstanding something fundamental.

      shared/1cWf69f8b

      A 1 Reply Last reply Reply Quote 0
      • A
        ambrogio @richreed2426 last edited by

        @richreed2426 The fact is that the zero candle does not exist, because it is the current one and it is forming at this moment
        The indicators always work with the candle closed, ie ID 1, because the current one does not yet have a defined value
        It is a mistake to work on candle ID 0

        1 Reply Last reply Reply Quote 0
        • R
          richreed2426 last edited by

          Thanks - this makes sense.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          Online Users

          A
          M
          W
          E
          G
          K
          E
          A
          S
          O
          S
          A
          N
          J

          21
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors