fxDreema

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

    Every n bars pass once at the start when it shouldnt

    Bug Reports
    3
    7
    674
    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.
    • V
      vhager last edited by vhager

      Hi,
      I'm using the block Every "n" bars in my project, and it seems the first time it is executed, it will pass no matter the number of bars. I use it in live mode not in backtest mode.
      After that, if it is executed again, then it seems to work as expected.

      Here is a little test i made:
      https://fxdreema.com/shared/RAe5HW65c

      The EA displays a message "2 bars counted" every 2 bars.
      I ran it on the 1M chart, and as you can see, the message is displayed as soon as the EA is started.

      0_1649993394054_02802376-bca2-46b3-b3d5-c29e909ac67c-image.png

      Then the message is displayed every 2 minutes as intended.

      When i check the code, it seems the value bartime is set to 0, therefore this condition will always set pass to true:
      0_1649993636338_5e222854-9297-4458-8edf-4a72e1568974-image.png

      Does it work as intended or am i mistaken somewhere? Can you fix this ?

      Thank you in advance,
      Valentin

      l'andorrà A 2 Replies Last reply Reply Quote 0
      • l'andorrà
        l'andorrà @vhager last edited by

        @vhager Firstly, that 'pass' block is unnecessary. You can remove it. Then I'm not completely sure what you exactly need. If I understand it correctly, you want a log to be printed once every two candles. Correct? If so, you will not get it the way you did it, because those blocks are on the 'on tick' tab. This means every tick both blocks will be executed no matter what. You need to add a 'once per bar' block on top for that to be checked just once every time a new bar is created. However, I guess that will no be enough because you will need additional conditions to be checked, right?

        (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

        (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

        (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

        1 Reply Last reply Reply Quote 0
        • V
          vhager last edited by

          Hi,
          Thank you for your reply.

          Yes I understand about the on tick tab, that it will trigger only if there is a tick happening, in this case, I'm using EURUSD on regular hours, so I'm pretty sure, there will be at least one tick on the 1 minute chart.
          This example is merely just to show about the block Every "n" bar.

          My expectation, is this block shouldn't pass until "n" bars have been detected, right? To demonstrate that, i ran a small EA:
          If i set n = 2, then it should not pass on the first bar, because the block only detected one bar (the bar where it was executed), then when the next bar arrives, on the tick event, the block now counts a second bar, and now it should pass.
          This is confirmed in the log, as you can see the EA passes every two bars.

          The issue I have is why the block Every N bars, passes as soon as the EA is executed for the first time. It hasn't detected two bars yet, so it shouldn't pass.
          If you see the log, at 12:24:30.484 the EA is initialized, then at 12:24:30.546 the message "2 bars counted" is displayed. This message shouldn't appear, as two bars should not have been detected.

          That's why i think there is a bug in the Every N bars block.

          l'andorrà 1 Reply Last reply Reply Quote 0
          • A
            ambrogio @vhager last edited by

            @vhager said in Every n bars pass once at the start when it shouldnt:

            Hi,
            I'm using the block Every "n" bars in my project, and it seems the first time it is executed, it will pass no matter the number of bars. I use it in live mode not in backtest mode.
            After that, if it is executed again, then it seems to work as expected.

            Here is a little test i made:
            https://fxdreema.com/shared/RAe5HW65c

            The EA displays a message "2 bars counted" every 2 bars.
            I ran it on the 1M chart, and as you can see, the message is displayed as soon as the EA is started.

            0_1649993394054_02802376-bca2-46b3-b3d5-c29e909ac67c-image.png

            Then the message is displayed every 2 minutes as intended.

            When i check the code, it seems the value bartime is set to 0, therefore this condition will always set pass to true:
            0_1649993636338_5e222854-9297-4458-8edf-4a72e1568974-image.png

            Does it work as intended or am i mistaken somewhere? Can you fix this ?

            Thank you in advance,
            Valentin

            You could create a variable counting candles, and place a condition like this:

            0_1650182713166_sgabello2.PNG

            1 Reply Last reply Reply Quote 0
            • l'andorrà
              l'andorrà @vhager last edited by

              @vhager Didn't tried that exercise. Maybe you're right. I recomnend you should contact the admin to let him know.

              (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

              (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

              (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

              1 Reply Last reply Reply Quote 0
              • V
                vhager last edited by

                Hi,
                Thank you both for your help.
                I'm indeed passing by this bug with the use of variables.

                How to contact the admin ? do they fix this kind of bugs ?

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

                  @vhager It's not a bug. Eg.: If you use "once per bar", should you start counting the current candle right? This is because in the candle ID1 maybe we have a triggered condition, so a possible trade failure because we have not counted the current candle. If you don't want to count the first candle simply skip it.

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

                  Online Users

                  A
                  E
                  R

                  8
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors