fxDreema

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

    How to approach if several conditions should be met but they span over several bars?

    Questions & Answers
    3
    3
    764
    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.
    • Y
      ylidor last edited by

      Hi FxDreema,

      If I'm not mistaken when we design the EA on the "on Tick" tab all the conditions that we add before a market order can be placed should be executed on the same bar. So all the condition have to be met at the same instance to be executed.

      I may have missed it by reading through the forum and I assume you have addressed it somewhere else but I couldn't easily find it, so I'm asking you here: what should be the general approach in FxDreema if one condition should be met on a certain bar x and then another one on the next y bars, and yet another on the next z bars (etc.) before a market order can be placed? It is important to add that I'm interested in 2 different scenarios:

      1. All the conditions should be true when the last one is met (i.e. the condition on bar x and y should still exist when the condition on bar z is met).

      2. The conditions on bar x and bar y have been met once or more but they may or may not persist when the condition on bar z is met.

      Thank you in advance for your guidance.

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

        I think, for this you need create own counters and switch between them, you can count bars using block "Once Per Bar" and after this you can create own counter with variable, like variable: int myCount1=0
        and after block Once per bar - add custom code block, with code: myCount1=myCount1+1; (or myCount++;)
        now you can this variable compare with something else with condition block ...
        and in certain time this counted variable null, lets say: myCount=0;

        Between trading and gambling is a very small gap, be careful.

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

          Under "on Tick" each block that is on top level (nothing connected in its white input) runs on every tick. When you have group of blocks and one of them can't pass, then this is the last block to work. But if you have multiple paths after one block, each path will run. Look at these examples https://fxdreema.com/examples/#Interface

          MetaTrader already provides arrays with candles data and indicators data. In all moments you can get O, H, L and C of candle 17 for example. The same goes for incdicators - by prividing Candle ID, you can get the value from that candle just like that.

          It's a little bit harder when you don't know the ID of the candle from which you want to get a value. But it depends, some things are already avalable, like the Highest value of N candles for example. Also, for custom indicators (My indicators) there are extra options in More settings

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

          Online Users

          2
          M
          M
          N
          B
          A
          B
          S
          E
          W
          M

          25
          Online

          146.6k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors