fxDreema

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

    Enter Previous Candle Close in a Variable

    Questions & Answers
    3
    21
    767
    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.
    • K
      karant last edited by

      Hi everyone,

      I'm new here, trying to create my first EA on fxdreema.

      Here's what I want to do:

      TRADE ENTRY

      1. When price crosses above 21 EMA (high prices), mark the candle close (variable : High_Alert) i.e store it in a variable.
      2. When any subsequent candle closes above the High_Alert, ENTER THE BUY TRADE.

      TRADE EXIT
      3) When price crosses below 21 EMA (low prices), mark the candle close (variable : Low_Alert) i.e. store it in a variable.
      4) When any subsequent candle closes below the Low_Alert, EXIT THE BUY TRADE.

      Here's the project I've created to execute that.

      https://fxdreema.com/shared/OzkjRXSHc

      However, when I run a backtest with this EA, it doesnt enter any trades.

      Can someone please help me understand what I'm missing here.

      Thanks in advace!

      X 1 Reply Last reply Reply Quote 0
      • X
        Xfire @karant last edited by

        @karant
        https://fxdreema.com/shared/OzkjRXSHc
        it is the algorithm for blocks

        IN GOD WE TRUST

        1 Reply Last reply Reply Quote 0
        • K
          karant last edited by

          @Xfire : Thank you for your response. Could you please help me understand what you mean?

          X 1 Reply Last reply Reply Quote 0
          • X
            Xfire @karant last edited by Xfire

            @karant You cant add "Close position" block to "Buy" block.
            always use "Buy" and "Sell" blocks as last blocks
            after open position use "If position " block for control your position

            IN GOD WE TRUST

            1 Reply Last reply Reply Quote 0
            • K
              karant last edited by

              I changed the last block to sell.
              Still no trades in the back test. still feel im missing something.
              https://fxdreema.com/shared/xKluEmBZ

              X 2 Replies Last reply Reply Quote 0
              • jstap
                jstap last edited by

                Is not taking trades likely becaus you have once per bar above conditions, either way I would test each part separately so I know what's causing problems.

                Learn fxDreema Without the Wait!

                My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                Don’t miss out

                Click here➡️ https://mybook.to/fxDreema to get your copy today!

                Enjoy! 😊

                X 1 Reply Last reply Reply Quote 0
                • X
                  Xfire @karant last edited by

                  @karant Your block 5 never cant pass condition.

                  IN GOD WE TRUST

                  K 1 Reply Last reply Reply Quote 0
                  • X
                    Xfire @karant last edited by

                    @karant What are you doing with block 4 !!!

                    IN GOD WE TRUST

                    K 1 Reply Last reply Reply Quote 0
                    • X
                      Xfire @jstap last edited by Xfire

                      @jstap and blocks 7,8,9 , you can remove all. i show you before if you don't want to learn then do not ask in topic

                      IN GOD WE TRUST

                      K jstap 3 Replies Last reply Reply Quote 0
                      • K
                        karant @Xfire last edited by

                        @Xfire: in block 4 my intent is to store the previous candle close in the variable High_Alert. To later use it to check for a close above this level to enter a trade.

                        1 Reply Last reply Reply Quote 0
                        • K
                          karant @Xfire last edited by

                          @Xfire : why won’t it pass? I’m checking for a close above the close of candle which crosses over the moving average.

                          1 Reply Last reply Reply Quote 0
                          • K
                            karant @Xfire last edited by karant

                            @jstap : yes I will remove each block and try

                            1 Reply Last reply Reply Quote 0
                            • jstap
                              jstap @Xfire last edited by

                              @Xfire I assume you pointed that reply at the wrong person 🙂

                              Learn fxDreema Without the Wait!

                              My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                              The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                              Don’t miss out

                              Click here➡️ https://mybook.to/fxDreema to get your copy today!

                              Enjoy! 😊

                              K 1 Reply Last reply Reply Quote 0
                              • K
                                karant @jstap last edited by

                                @jstap : Yeah

                                1 Reply Last reply Reply Quote 0
                                • K
                                  karant @Xfire last edited by karant

                                  @Xfire : I removed all the additional steps - the EA takes trades on close above MA crossover now. Thanks - was good to see the EA actually do something.

                                  How do I store a crossover candle close value in a variable now and enter trade when price closes above it?

                                  1 Reply Last reply Reply Quote 0
                                  • K
                                    karant last edited by

                                    I've put the the entry and exit into separate areas.

                                    Still being unable to enter order. Requesting help to enter a buy trade when price closes above the crossover candle close.

                                    https://fxdreema.com/shared/QHpyfZ28e

                                    X 1 Reply Last reply Reply Quote 0
                                    • X
                                      Xfire @karant last edited by

                                      @karant
                                      What does it mean, Candle 1 > Candle 1 ?!!!!! this block never pass
                                      Screenshot 2023-07-14 212929.jpg

                                      IN GOD WE TRUST

                                      1 Reply Last reply Reply Quote 0
                                      • K
                                        karant last edited by karant

                                        I've stored the close of the Crossover Candle (Candle 1 immediately upon crossover) in the variable Buy_Alert (not sure if the algo is doing that - but thats the intent).

                                        Then checking if any subsequent candle (respective Candle 1 from time to time) closes above the value store in Buy Alert - this is the confirmation to enter buy trade.

                                        X 1 Reply Last reply Reply Quote 0
                                        • X
                                          Xfire @karant last edited by Xfire

                                          @karant it is not the next candle. it is the current candle. you can compare the candle 1 and 2 at the same time.
                                          You don't know about algorithm. just first read some information about how can create algorithm for coding. it is better for your time .

                                          IN GOD WE TRUST

                                          1 Reply Last reply Reply Quote 0
                                          • jstap
                                            jstap last edited by jstap

                                            Candle 0 is current, candle1 is previous and closed, close on 0 is the current price.

                                            Learn fxDreema Without the Wait!

                                            My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                                            The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                                            Don’t miss out

                                            Click here➡️ https://mybook.to/fxDreema to get your copy today!

                                            Enjoy! 😊

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

                                            Online Users

                                            N
                                            L
                                            A
                                            M
                                            B
                                            E
                                            S
                                            M

                                            20
                                            Online

                                            146.6k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors