fxDreema

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

    Position´s Expiration

    Questions & Answers
    3
    7
    2091
    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.
    • J
      josecortesllobat last edited by

      "Check age" block allows to do something when its condition to pass is met. I am using it like a position´s expiration condition so when the true output is activated, the EA closes all positions.

      It Works pretty well but the code that is checking how much time has passed since the position was opened also is taking into account the weekend days. For that, a position can be closed on Monday because the position´s age has met the "check age" block condition but it is not the real age.

      0_1539185135083_03bdaadc-714a-4867-b0a7-e151f1456ee8-image.png

      The example above shows a postition expired (EXP) at the first Monday´s bar but it is not the real age.

      How can I avoid the weekend days for the "check age" block?

      Thanks

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

        Interesting question. I might take a look at this problem, to exclude Sat and Sun somehow.

        1 Reply Last reply Reply Quote 0
        • J
          josecortesllobat last edited by

          It Will be very welcome.

          Thanks

          1 Reply Last reply Reply Quote 0
          • J
            josecortesllobat last edited by

            Hi @fxDreema

            For the "check age", would it be posible to add like a "how many bars since trade open" mode? This way, the weekend days Will be avoided.

            My current condition to check "real" trade age is:

            If "BarCounter >= ExpirationBars -> Close"

            Thanks

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

              I was playing with this block a little bit (locally on my own PC) and I was able to detect and remove weekdays. But it is interesting situation if for example someone wants to detect age of 1 month. 1 month sounds like 30 days, but if weekdays are removed, the actual workdays are 20 and something.

              Also, if I do that for this block, I think I should do that for other blocks, for the expiration of pending orders. I mean, everywhere where there is expiration, I think I should exclude all weekdays and work only with workdays.

              Bars count.... In my MT4 I actually have candles recorded for Sundays, not always. Take a look:
              0_1540407222213_69dcd5ee-830f-4727-a440-c655db08291c-image.png

              22 July this year is Sunday and those 3 candles (M15 timeframe) are recorder for 22 July. I wonder why I have more that 3 candles in History Center, but anyway:

              0_1540407455827_5b80ff33-1861-48c6-9a52-103e6dc96c94-image.png

              I want to say, I'm not sure how accurate will be if you use bars count. And when you backtest, sometimes you have missing candles in random time periods.

              G 1 Reply Last reply Reply Quote 0
              • J
                josecortesllobat last edited by

                Understood!!!

                Don't waste your time trying to figure this out because I have different options working pretty accurate for expiration.

                Thanks

                1 Reply Last reply Reply Quote 0
                • G
                  GeoFX @fxDreema last edited by GeoFX

                  @fxdreema I've stumbled on the "Check age" block encompasses weekends issue. It is pity this simple but useful block is not flexible to skip weekends, market holidays or skip any given period market was closed, because the period of time that is implied by the notion "CHECKING AGE" is the actual period market was open only.
                  Yes, there are other ways to check age excluding holidays, but the "Check age" block is the most intuitive one for the newbies, and IMHO deserves to have such options. Even for me, because I still struggling with variables) Thank you @fxDreema for the great robot-building framework, nonetheless. @GeoFX/2+ years happy FXDreema user

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

                  Online Users

                  A
                  T
                  M
                  E
                  C
                  B

                  18
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors