fxDreema

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

    How to extract the HH part of the candle time?

    Questions & Answers
    2
    3
    168
    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.
    • F
      fxgump last edited by fxgump

      I am trying to extract the HH part of the candle time so as to compare it to a fixed value. Can this be done?

      I tried the following but it doesn't work

      d8f1d65b-ee22-479e-a73f-6707e6b3dd0f-image.png

      NB: using the time filter block doesn't work as I want to check candle of previous days

      1 Reply Last reply Reply Quote 0
      • F
        fxgump last edited by

        Solved. I had ChatGPT write the following code:

        When using ChatGPT or Deepseek to write code, mention that it will be used in fxdreema. These 2 AI robots know fxdreema and know how it works

        // --- Parse all start and end times into total minutes ---

        // Asian
        int aStartHour = StringToInteger(StringSubstr(AsianStartTime, 0, 2));
        int aStartMinute = StringToInteger(StringSubstr(AsianStartTime, 3, 2));
        int aStartTotal = aStartHour * 60 + aStartMinute;

        int aEndHour = StringToInteger(StringSubstr(AsianEndTime, 0, 2));
        int aEndMinute = StringToInteger(StringSubstr(AsianEndTime, 3, 2));
        int aEndTotal = aEndHour * 60 + aEndMinute;

        // Europe
        int eStartHour = StringToInteger(StringSubstr(EuropeStartTime, 0, 2));
        int eStartMinute = StringToInteger(StringSubstr(EuropeStartTime, 3, 2));
        int eStartTotal = eStartHour * 60 + eStartMinute;

        int eEndHour = StringToInteger(StringSubstr(EuropeEndTime, 0, 2));
        int eEndMinute = StringToInteger(StringSubstr(EuropeEndTime, 3, 2));
        int eEndTotal = eEndHour * 60 + eEndMinute;

        // NY
        int nStartHour = StringToInteger(StringSubstr(NYStartTime, 0, 2));
        int nStartMinute = StringToInteger(StringSubstr(NYStartTime, 3, 2));
        int nStartTotal = nStartHour * 60 + nStartMinute;

        int nEndHour = StringToInteger(StringSubstr(NYEndTime, 0, 2));
        int nEndMinute = StringToInteger(StringSubstr(NYEndTime, 3, 2));
        int nEndTotal = nEndHour * 60 + nEndMinute;

        // --- Get the candle time in total minutes ---
        datetime candleTime = iTime(Symbol(), tf, candle_id);
        int candleHour = TimeHour(candleTime);
        int candleMinute = TimeMinute(candleTime);
        int candleTotalMinutes = candleHour * 60 + candleMinute;

        // --- Check all three session windows ---
        bool inAsian = (candleTotalMinutes >= aStartTotal && candleTotalMinutes < aEndTotal);
        bool inEurope = (candleTotalMinutes >= eStartTotal && candleTotalMinutes < eEndTotal);
        bool inNY = (candleTotalMinutes >= nStartTotal && candleTotalMinutes < nEndTotal);

        // --- Final decision ---
        if (inAsian || inEurope || inNY) {
        Output = 1;
        } else {
        Output = 0;
        }

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

          Thank you for sharing.

          (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

          O
          K
          M
          M
          C

          21
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors