JamilPotts: Not so easy since I have to identify and hold the highest 4HR candle of last week as the new week progresses so it took a few thousand lines of code to accomplish that.
If there is a way to do it using currenttime or datetime or any other method please let me know.
Thousands? No! You know when the week starts and when it ends. iBarShift gives you the index range and iHighest tells you which.
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)
Thousands? No! You know when the week starts and when it ends. iBarShift gives you the index range and iHighest tells you which.
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)
I've been coding only a few months and the description for using ibarshift on the mql4 website isn't written in a way that I understand that it can be used in the way you are saying.
To clarify what I wrote thousands of lines of code for is there are 6 4hr candles a day. if for example the high of last week was wednesday, and the highest 4hr candle was the 08:00 candle, then I would need to reference that candle every day of the new week. On Monday at 00:00 that would be 16 candles back but by Friday 00:00 that would be 40 candles back. In the way I wrote the code to my understanding of how to use iHighest for example...
int Highest4HR12=0; if (FHOW && Mon && (iTime(NULL,240,0) == D'00:00:00')) Highest4HR12 = Htwelve1; if (FHOW && Mon && (iTime(NULL,240,0) == D'04:00:00')) Highest4HR12 = Htwelve2; if (FHOW && Mon && (iTime(NULL,240,0) == D'08:00:00')) Highest4HR12 = Htwelve3; if (FHOW && Mon && (iTime(NULL,240,0) == D'12:00:00')) Highest4HR12 = Htwelve4; if (FHOW && Mon && (iTime(NULL,240,0) == D'16:00:00')) Highest4HR12 = Htwelve5; if (FHOW && Mon && (iTime(NULL,240,0) == D'20:00:00')) Highest4HR12 = Htwelve6;
something like posted above for every day of the previous week and this week. In the example FHOW = Friday High Of Week, Mon = Today is Monday, and current time is (candle specified)
//Last Weeks High is Friday //If Monday //If Monday 00 and Last Week High is Friday int Htwenty1 = iHighest(_Symbol,240,MODE_HIGH,6,1) == 1; int Hsixteen1 = iHighest(_Symbol,240,MODE_HIGH,6,1) == 2; int Htwelve1 = iHighest(_Symbol,240,MODE_HIGH,6,1) == 3; int Height1 = iHighest(_Symbol,240,MODE_HIGH,6,1) == 4; int Hfour1 = iHighest(_Symbol,240,MODE_HIGH,6,1) == 5; int Hzero1 = iHighest(_Symbol,240,MODE_HIGH,6,1) == 6;
Here are the variables for one day back if Monday, I wrote code for each day back and each day forward as explained above.
Also it would be helpful if you wrote an example, for instance, am I to use ibarshift somehow inside the ihighest parameters?
int High = ibarshift(parameters)
iHighest(NULL,0,High,0)
Would that be correct? I will be troubleshooting myself until you reply again.
And while using the code that will consolidate my code into simpler language, I would still need to know how to call forward the values of the highest 4HR candle of the previous week and the candles following it. Can you break that down for me.
Thank you.
Thousands? No! You know when the week starts and when it ends. iBarShift gives you the index range and iHighest tells you which.
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)
Also from my current understanding of datetime, using ibarshift I run into the same issue of having to put the specific date of last Monday and last Friday. Quite possibly a small task to do once a week, however the ultimate goal of coding is that the algorithm can run on it's own without me having to do that. Is there a way to use datetime where a previous Monday and Friday can be automatically called?
use DayOfWeek to determine the day

You need to learn to code.
int iEOW(int iBar){ // Find the last bar of the week int DOW = TimeDayOfWeek( Time[iBar) ); for(;; ++iBar){ int pDOW = TimeDayOfWeek( Time[iBar) ); if(pDOW > DOW) break; // Curr. was Monday(1) Prev. is Friday(7) DOW = pDOW; } return iBar; } ////////////////////////// int iBeg = iBow(0), iEnd = iBow(iBeg), count = iEnd - iBeg; int iHH = iHighest(NULL,0,MODE_HIGH,count,iBeg);
Was that so hard you couldn't try it?
Because you are just being lazy. Learn to code. Code your attempt. State the problem. You did nothing.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I hope this is not a duplicate topic, and if it is please direct me.
I have been writing a code to identify the highest day of the previous week (easy stuff), and the highest 4HR candle of the highest day of the previous week.
Not so easy since I have to identify and hold the highest 4HR candle of last week as the new week progresses so it took a few thousand lines of code to accomplish that.
That being said I want to identify if last weeks high was friday, was the highest 4hr candle open broken to the downside by the next candle or candles.
is there a way using the information store in iHighest to call the values of the following candles in the iHighest array? Or would I have to manually code 4hr by 4hr candles?
I tried using datetime, but since using datetime you need to specify the day or it defaults to the current day I have not found a way to call previous days without using a specific date.
If there is a way to do it using currenttime or datetime or any other method please let me know.
If I need to attach code please let me know thanks.
Thank you.