fxDreema

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

    Pass N times

    Questions & Answers
    2
    10
    1807
    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.
    • M
      maurysvva last edited by

      I'm not probably very good at using loop blocks... now I need to pass 3 times into a flow, then stop to pass if there's a position running (MT5).

      here the flow:

      No pending orders-->conditions-->once per bar--->BUY/SELL

      I need to pass this flow 3 times (once per bar) and then stop it until the positions created by the flow (one, because MT5 adds each position of the same type) are closed.

      Example: (conditions met)
      first minute: 1 lots buy
      second minute: 1 lot buy
      third minute 1 lot buy

      Now I have 3 lots in the same positions, the program have to stop buying until the 3 lots are closed.

      Thanks 🙂

      P.S. I tried pass Loop(pass "n" times) and the reset block without success!

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

        No no, Loop (pass n times) is something that will activate it's output N times when you run it once. Try Counter: Pass n times instead 🙂 There is another way, to connect 2 more "Once per bar" blocks (to the yellow outputs).

        I think I should add some "n" option inside blocks like "Once per bar". The problem is their name, which contains the word "once", but maybe no one cares about that 🙂

        1 Reply Last reply Reply Quote 0
        • M
          maurysvva last edited by

          I'm trying, but it doesn't work, for now....."Counter pass n times" after "once per bar" or... before ?
          could you suggest me how to connect two more once per bar blocks with the yellow outputs ?

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

            https://fxdreema.com/shared/umEZTDwX
            https://fxdreema.com/shared/uDDvVNzRb

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

              https://fxdreema.com/shared/RLWcgk7rd 🙂

              1 Reply Last reply Reply Quote 0
              • M
                maurysvva last edited by

                You are in continuous development on request! thank you.

                I tried the new block but it seems in mt5 doesn't work properly, or maybe is not what i was thinking.
                All the three examples generate 3 buy operations in the same candle...

                Also the new "once per bar" block generates 3 operations in the same candle.

                About the last one (once per bar with n max to pass) how to reset the "n" Max times to pass ?

                What I needed was:

                If there's a position running, buy only once per candle and maximum 3 times in absolute.
                When there's no positions start again the program (reset "n" max times to pass)

                Thank you,

                Maurizio.

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

                  I decided that you want Once per bar to work as Multiple times per bar 😕

                  Now I'm confused, because you are talking for pending orders and position, so I don't know what must happen 3 times. But I feel that all the needed blocks are there and it depends on how are they connected. There are counters with ability to reset them with another block at different place on the project, blocks like "Once per...", "Check pending orders count". Well, "Check positions count" is not useful here, it's a little bit tricky to count the number of positions in the position 🙂

                  1 Reply Last reply Reply Quote 0
                  • M
                    maurysvva last edited by

                    Right!
                    I written a quite complicated 45 blocks expert advisor, it's nice and it works well, I thought that the counter and the relative reset block was the most simple in my flow but it isn't for me 😄
                    Me too I think that there's all necessary, but for the moment i can't connect blocks in the right way.
                    I tried to simplified in my post because the rest of the flow is not important.
                    However in the real would be:

                    No pending orders-->pass 3 times-->once per bar-->buy pending order

                    If no positions is running-->reset counter

                    It seems it doesn't work in MT5 but I will try again in the next day and I'll report here.

                    1 Reply Last reply Reply Quote 0
                    • M
                      maurysvva last edited by

                      Here the correct flow to pass n times using also once per bar block

                      No pending orders-->once per bar--->pass n times--->buy pending order
                      If no positions is running--->reset counter

                      Set the correct counter ID!

                      If you put pass n times before once per bar it doesn't work.

                      I hope it'll be helpful.

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

                        Yes, for blocks like these that contain internal counters it's very important where they are connected. Their current state depends mostly on the number of times they are executed. You know that under "on Tick" the block on the top of the group (of blocks) is executed on every tick, often multiple times per second. Don't forget that 🙂

                        Expert Advisors are not just scripts, they are programs based on events. When you have events, then you have states. This requires good imagination 🙂

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

                        Online Users

                        M
                        2
                        M
                        M
                        N
                        B
                        A
                        B
                        S
                        E
                        W
                        M

                        34
                        Online

                        146.6k
                        Users

                        22.4k
                        Topics

                        122.6k
                        Posts

                        Powered by NodeBB Forums | Contributors