fxDreema

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

    Candle Shift ID for friday

    Questions & Answers
    2
    5
    857
    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.
    • A
      adz_b last edited by

      Hi,
      my EA needs to know the daily low of the friday candle but if you use the shift ID 1 on the daily setting it does not recognise friday as the previous candle??? Can anyone help, thanks.

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

        Interesting question, and I have no good idea how to make it easily on the EA builder. As a code, I imagine having a loop to find the candle from the last friday, try this for example:

        int OnInit()
        {
        	int shift = 0;
        	while (true)
        	{
        		datetime time = iTime(Symbol(), PERIOD_D1, shift);
        		shift++;
        		if (TimeDayOfWeek(time) == 5) {
        			break;
        		}
        	}
        	
        	Comment(shift);
        }
        
        1 Reply Last reply Reply Quote 0
        • A
          adz_b last edited by

          Thanks very much for your reply I will try this and let you know if it works. Much appreciated!

          1 Reply Last reply Reply Quote 0
          • A
            adz_b last edited by

            I'm not sure where best to place this in the code for it to work.

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

              https://fxdreema.com/shared/fMzA0vdhc

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

              Online Users

              B
              T
              C
              M

              15
              Online

              146.9k
              Users

              22.4k
              Topics

              122.6k
              Posts

              Powered by NodeBB Forums | Contributors