fxDreema

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

    How can I check the last closed trade was open on candle ID 0?

    Questions & Answers
    2
    6
    47
    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.
    • l'andorrà
      l'andorrà last edited by

      I need to identify those trades that were open and closed within candle ID 0. I'm not sure why this config is not working:

      01.png

      Is the comparison searching for the exact UNIX time the current candle was open, maybe? The trade can be closed at any moment AFTER the current candle was open. It doesn't need to be open at the first tick of the current candle, as this setting is apparently doing.

      Am I missing something?

      (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
      • jstap
        jstap last edited by jstap

        Try this:

        7712b516-73c8-482f-b5b2-c0fda6790b6c-msedge_M8sOKN3gWx.png

        Learn fxDreema Without the Wait!

        My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

        The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

        Don’t miss out

        Click here➡️ https://mybook.to/fxDreema to get your copy today!

        Enjoy! 😊

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

          I'm afraid it didn't work. 😞

          (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.

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

            @l-andorrà This is what ChatGPY created.

            //+------------------------------------------------------------------+
            //| Function to check if trade was opened and closed in same candle |
            //+------------------------------------------------------------------+
            bool IsTradeClosedInSameCandle(ulong ticket)
            {
            // Get trade history by ticket
            HistorySelect(0, TimeCurrent());
            ulong history_ticket = HistoryOrderGetTicket(ticket);

            if(history_ticket == 0)
            return false;

            // Get trade open and close times
            datetime open_time = (datetime)HistoryOrderGetInteger(history_ticket, ORDER_TIME_OPEN);
            datetime close_time = (datetime)HistoryOrderGetInteger(history_ticket, ORDER_TIME_DONE);

            if(open_time == 0 || close_time == 0)
            return false;

            // Get current timeframe in seconds
            ENUM_TIMEFRAMES current_tf = Period();
            int tf_seconds = PeriodSeconds(current_tf);

            // Calculate candle start times
            datetime open_candle_start = open_time - (open_time % tf_seconds);
            datetime close_candle_start = close_time - (close_time % tf_seconds);

            // Check if both open and close are in same candle
            return (open_candle_start == close_candle_start);
            }

            How could I make it work below a 'For each position' block?

            (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
            • jstap
              jstap last edited by

              I assume this did what was needed, I use ChatGPT for this type of code, the problem is that the FX trade time returns as a string, not a number. This is MT4 but will show you what I mean:

              https://fxdreema.com/shared/sNumqU5Nd

              Learn fxDreema Without the Wait!

              My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

              The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

              Don’t miss out

              Click here➡️ https://mybook.to/fxDreema to get your copy today!

              Enjoy! 😊

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

                Interesting. I don't understand why it doesn't work on MT5. 😞

                (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
                • 1 / 1
                • First post
                  Last post

                Online Users

                C
                G
                D

                11
                Online

                146.6k
                Users

                22.4k
                Topics

                122.6k
                Posts

                Powered by NodeBB Forums | Contributors