fxDreema

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

    Market Close Time

    Questions & Answers
    2
    8
    1917
    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 josecortesllobat

      Hello

      Usually the markets close on Friday about 23:00 depending on the server´s timezone. I would like to close any opened position before that time but as much closer as posible to the market´s closing time. Because my EA trades in high timeframes and it checks the project´s logic at the bar´s opening, I am not able to figure out how to close all opened trades if the bar´s open does not match with my condition.

      As an example: TimeFrame == H8 (bar´s open at 0:00, 8:00 & 16:00 each day)

      If I set: OncePerBar (H8) -> If DayOfWeek == Friday && HoursFilter == 16:00 - 23:00 -> CloseAll, it Works pretty well.

      0_1539013615667_a90ac432-40e9-4d45-917f-2833ec9f1a21-image.png

      But what I would like to set is like: OncePerBar (H8) -> If DayOfWeek == Friday && HoursFilter (or Time) == 22:00 - 23:00 -> CloseAll

      I tried

      0_1539013049728_3433f6dc-2eb2-41a9-92d3-dd27f4f798a1-image.png

      I have placed that block's group on the top´s Project to allow the ticks pass through it but it does not work. Block #81 is a "Pass" block.

      Any suggestion Will be very welcome.

      Thanks

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

        Can you tell which block doesn't work? If you put Draw arrow after any block, you can detect whether it worked or not. Also do you have some error messages?

        By the way, by default MarketCloseSwitch is set to "false", also try to see if you really changed it to "true", otherwise I don't see how block 79 can be reached.

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

          Hi @fxDreema

          The blocks work if I set the ClosingMarketTime at Bar´s open.

          Let´s say, I want the EA trades in TF == H8. The EA only checks the project´s logic OncePerBar (bar´s open). Then, if I set

          WeekDayFilter == Friday && HourFilter == 16:00 - 23:00 (connected to the OncePerBar block)

          when the last bar on Friday (H8) opens at 16:00, the EA closes all the positions. This Works pretty well. Because my EA trades in H8, it is not posible to check that condition at any bar´s open after 16:00 because in H8 there is not any bar that opens at 22:00. For this reason, I placed the blocks group without connection to the "Once Per Bar" block and with a "Pass" block on the top to let the ticks do the condition check. But it does not work even though the MarketCloseSwitch is set to "true".

          I Will try some more checks and I Will update on this.

          Thanks for helping.

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

            Hi @fxDreema

            0_1539160695321_0c088e3c-754c-45d7-8704-5432af355242-image.png

            That Works if the tester execution is set to "Every tick". I was using "Open prices only" so there was no way to let the EA checks that condition.

            Thanks for helping.

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

              But in H8 there are 3 candles, one for 00:00, one for 08:00 and one for 16:00. Your "Hours filter" is between 22:00 and 23:00. If Open prices only works on the open prices only, there are only 3 "ticks" for the day - at 00:00, 08:00 and 16:00. No tick comes after 16:00.

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

                Hi fxDreema

                Yes, you are right and I know that.

                What I wanted to say with "...after 16:00 because in H8 there is not any bar that opens at 22:00..." is that there is none bar after 16:00 on Friday in H8.

                What I would like to find is a "trick" that allows me to check a condition at 22:00 on Friday in H8 to close the trades at Market Close time but using Once per bar. It works with Every Tick.

                Thanks

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

                  I don't know how can you do that. "Once per bar" is made so that the EA can be backtested quickly, and MetaTrader "feeds" the EA with ticks - 1 per candle - but in H8 there is no candle at that time, and I don't know how can you tell MetaTrader to produce extra tick at 22:00. But why don't you try with another timeframe, maybe this can work somehow?

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

                    Hi fxDreema

                    It is just an idea. No worries. I have other options that I tested and it works pretty well even though there are not what I would like.

                    Thanks

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

                    Online Users

                    N
                    M
                    M
                    E
                    J
                    K
                    T

                    19
                    Online

                    146.7k
                    Users

                    22.4k
                    Topics

                    122.6k
                    Posts

                    Powered by NodeBB Forums | Contributors