This is the closest information I found for my recent problem. Something that will find multiple values in the past with the same conditions but different index. Thank you! 🙏
nvm. closed to new members haha. makes sense. the world should be beating down a path to your door. thank you for all you do to help educate others. +1
waoh ! Thank you @OrchardForex for that. Please how to add into the code a function to draw a trendline on specific pattern like if its detects a consecutive tripple bullish or bearish bars, robot has to draw a horizontal short trend line on their highest prices or on their lowest prices ?
Thank you so much Richard for sharing this technique. I was stuck on how to handle negative bars and you pulled me out of it. I am now trying to modify the code, so that it waits 5 bars, before repainting. Tried to wrap some part of code around (if (prev_calculated == 0 ) .... else if checknewbar() ...... No luck so far...Not sure how other platforms manage to wait 5 bars in reality when a negative offset/look ahead shoulder is specified. I'm back to solving the problem :)
Instead of fixing the bars to look for to 5 can you keep it variable/dynamic (how humans do) to get accurate highs and lows? This will help in correctly identifying break of structure and change of trend. Fixing the bars often leads to fake break of structures. I want to avoid that.
Nice code as usual.. but if u can extend the code to find if price crosses the line from above & from below, we will b able to use it to automate price cross strategies…
Thank you so much, great video, can you please make a video about creating a semi-log scale for Y axis via MQL, is it possible to do that in metatrader?
hello Richard. i've been a long time follower of your classes and pointers and this was an eye opener. i however have a question on how to use the static double to save the high function (or any other coding reference that you may have), of the peak bars to be used as references for trade entries. like say a peak candle in the 30 minute timeframe to be a reference point of entry in a reference entry point for a lower timeframe.
Excellent video, thank you very much. Is it possible to do example of programming an alert indicator for specific time frame when the chart e.g create a low followed by high low then continues to form higher high, pulls back to retest the high low. The program must sound when market retest the high low or send an email. Meaning on a downtrend the chart will form a high then form a higher low followed by lower low, when chart retest higher low the program should sound or send an email
Thanks for this amazing tutorial! Why is it currentBar-count and not currentBar-count+1? currentBar+1 takes currentBar one bar leftwards (so, if the index of currentBar is 10, it will be 11) and currentBar-count takes currentBar five bars rightwards (so, if currentBar is 10, it will be 10-5 = 5), so I think in this way the currentBar-count is one bar a head of currnetBar+1. Where am I missing the point?
The function with your example is looking for a bar with 5 (say lower) to left and right. That means bars 5-9 must be lower and also bars 11-15. So start bar is 10-5 for a search distance of 11
Thanks for this Mr Orchard. Please, how are we going to create High1, High2, Low1, and Low2 in order to be able to use this function for buy or sell entry? For instance, say, if H2 > H1 (BuyEntry). In this case, H1 is the Peak1 and High2 os the Peak 2. Does everything in the findpeak functions = H1/H2/L1/L2 ? I would be more than happy of I get a solution to ghis questions. Thanks for the training once again.
Thank you very much. Yet again works fantastically. One question would be. I was drawing the D1 Trendlines with the script, and when changing to the 5M TF, the trendline remains on the start of the day instead of being on the actual low that occurred during that day.... Is there an easy fix to this? And a big thank you again for the videos, very easy to understand.
Dear great Mr.Ochard Please make multiple videos on how to make all the pattern in codes Like head & shoulders Widgets ( Raising & falling ) All the technical patterns please Thanks in advance MQL King
Interesting video. So how does one create an ea or indicator using zig zag to find out if the previous candle broke and closed below or above the previous zig zag high or low point?
What if peaks and lows are not based on iHighest, iLowest functions, but on a price shift? Meaning, if for a candle number 15 the price moves lower for 40 pips on both sides of the chart, then we consider High[15] as a swing Peak.
For some reason I'm getting these errors for lines 20 and 29 'ObjectDelete' - no one of the overloads can be applied to the function call could be one of 2 function(s) built-in; bool ObjectDelete(long,const string) built-in; bool ObjectDelete(const string)
@@OrchardForex Sir Thanks A Lot , I have made a indicator , which projection of new bar from M15 to Weekly high low , and make it free for MQL5 Community , you can convert it to expeert . if you permit me i will send you coode. Thanks .
Excellent lesson. Thank you once again. I am having problem with OrderSelect() function returning error 0 and leading my EA to believe that there is no open order opened by it. This happens mainly when I have another instance of this EA running on a different pair. I use different magic numbers for each instance. Please make a lesson on how to solve this. Thank you.
OrderSelect returns a boolean indicating select was successful or not. It has no filters to select by symbol or magic. It appears you may be using OrderSelect incorrectly.
Hello, I am writing my own version of this but in the form of an indicator. When filling the line buffer I keep getting array out of bounds. I am resizing the array to be the size of rates_total + 1 on each on calculate call but I am still getting the error. Is it possible to do a tutorial on how to create an indicator when using the coppybuffer function is not applicable?
@@OrchardForex it doesn't help, if you can please make a simple EA which can trade every candles but the moment it's either buy or sell it stops trading until new candle appears.
I found this interesting and I'm backtracking it in my EA. can you please write an array function to include the last 10 upper and lower points. Thank you
I have troubles adding this to my EA! Can anyone assist me? I am new to code so this is kind of a problem for me… @orchard forex do you do small jobs i don’t have much but can pay something
This script calls functions to find high and low points. You can just copy the function into your EA to do the same there but how you use the function depends on what your EA plans to do. The lines the script draws are really just for display.
@@makeit707 I'm not sure what you are asking. This function just finds high and low points. You would need to have a way of using that in your expert. For example if h1 is the most recent high value from the function and h2 is the high before that, and you have similar l1 and l2 for low points, you might want to buy if h1 is higher than h2 and l1 is higher than l2. A traditional higher highs and higher lows. In that cast the and coudition would be if ( (h1>h2) && (l1>l2) ). For an or condition you still need to decide what you are testing then use || instead of &&
@@OrchardForex what i am aiming for is if current candle is higher than higher point and candle(1) is a bear OR candle(2) is a bear than buy, thats what i am battling with the OR
@@makeit707 So you use the function to get the recent high point, say you put that in double recentHigh. Then you have current price in a variable like double price. And for candles 1 and 2 you have open and close prices like open1, open2, close1, close2. A bear candle is where close
void OnStart() {
int shoulder = 5;
int bar1;
int bar2;
bar1 = FindPeak(MODE_HIGH, shoulder, 0);
bar2 = FindPeak(MODE_HIGH, shoulder, bar1+1);
ObjectDelete(0, "upper");
ObjectCreate(0, "upper", OBJ_TREND, 0, iTime(Symbol(), Period(), bar2), iHigh(Symbol(), Period(), bar2), iTime(Symbol(), Period(), bar1), iHigh(Symbol(), Period(), bar1));
ObjectSetInteger(0, "upper", OBJPROP_COLOR, clrBlue);
ObjectSetInteger(0, "upper", OBJPROP_WIDTH, 2);
ObjectSetInteger(0, "upper", OBJPROP_RAY_RIGHT, true);
bar1 = FindPeak(MODE_LOW, shoulder, 0);
bar2 = FindPeak(MODE_LOW, shoulder, bar1+1);
ObjectDelete(0, "lower");
ObjectCreate(0, "lower", OBJ_TREND, 0, iTime(Symbol(), Period(), bar2), iLow(Symbol(), Period(), bar2), iTime(Symbol(), Period(), bar1), iLow(Symbol(), Period(), bar1));
ObjectSetInteger(0, "lower", OBJPROP_COLOR, clrBlue);
ObjectSetInteger(0, "lower", OBJPROP_WIDTH, 2);
ObjectSetInteger(0, "lower", OBJPROP_RAY_RIGHT, true);
}
int FindPeak(int mode, int count, int startBar) {
if (mode!=MODE_HIGH && mode!=MODE_LOW) return(-1);
int currentBar = startBar;
int foundBar = FindNextPeak(mode, count*2+1, currentBar-count);
while (foundBar!=currentBar) {
currentBar = FindNextPeak(mode, count, currentBar+1);
foundBar = FindNextPeak(mode, count*2+1, currentBar-count);
}
return(currentBar);
}
int FindNextPeak(int mode, int count, int startBar) {
if (startBar
Are you on telegram?
thank you. was missing that final ) on the ObjectCreate for both upper and lower and this was helpful
@@TheJoshuamcgowan can u connect via telegram ?
@@AmeerGill are you on telegram?
I need a coder to network with so we can optimize some indicators.
I have 85% winrate strategy using 6 indicators.
You are really the best! I have been trying this for 6 months with no success... Thank You!
This is the closest information I found for my recent problem. Something that will find multiple values in the past with the same conditions but different index. Thank you! 🙏
Glad it was helpful!
It is amazing how you solve such difficult problems to a novice in a simplistic and stylish manner. Thank you, I am learning so much from you.
Glad it was helpful!
Excelente, muchas gracias
once i finish up my primary work projects im joining your private group. combo of teaching, programming, and trading skills is unique for sure
nvm. closed to new members haha. makes sense. the world should be beating down a path to your door. thank you for all you do to help educate others. +1
Thank you very much for this!
Thanks so much for all your videos
Everyone on of them is the best
Glad you like them!
Thanks Richard for your education.
Another piece of code added to my toolbox, thanks.
Thank you, this is great!!
waoh ! Thank you @OrchardForex for that. Please how to add into the code a function to draw a trendline on specific pattern like if its detects a consecutive tripple bullish or bearish bars, robot has to draw a horizontal short trend line on their highest prices or on their lowest prices ?
Amazing 🥰 Thank you.
Thank you so much Richard for sharing this technique. I was stuck on how to handle negative bars and you pulled me out of it.
I am now trying to modify the code, so that it waits 5 bars, before repainting. Tried to wrap some part of code around (if (prev_calculated == 0 ) .... else if checknewbar() ...... No luck so far...Not sure how other platforms manage to wait 5 bars in reality when a negative offset/look ahead shoulder is specified. I'm back to solving the problem :)
Just start the calculations 5 bars back and check at every new bar
Thanks!! That was useful!
Glad to hear it!
Thanks mate very good video and coding.
Thank you
Amazing!
Thanks!
thank you, sir 😁
Instead of fixing the bars to look for to 5 can you keep it variable/dynamic (how humans do) to get accurate highs and lows? This will help in correctly identifying break of structure and change of trend. Fixing the bars often leads to fake break of structures. I want to avoid that.
Nice code as usual.. but if u can extend the code to find if price crosses the line from above & from below, we will b able to use it to automate price cross strategies…
This shows how to draw the line, after that all you have to do is check for price crossing.
I m new big fan of you sir ❤❤❤❤
Thank you so much!
Glad it helped!
greate... works almost correct
Thank you so much, great video, can you please make a video about creating a semi-log scale for Y axis via MQL, is it possible to do that in metatrader?
Hello. Can you show me how to make a counter of open and closed positions so that the ADVISER opens only one position to buy or sell during this day?
hello , how about finding equal peaks like double top
hello Richard. i've been a long time follower of your classes and pointers and this was an eye opener. i however have a question on how to use the static double to save the high function (or any other coding reference that you may have), of the peak bars to be used as references for trade entries. like say a peak candle in the 30 minute timeframe to be a reference point of entry in a reference entry point for a lower timeframe.
The functions allow you to specify the TF so just specify the M30. If you have a peak in M30 then it must also be a peak in any lower TF.
Excellent video, thank you very much. Is it possible to do example of programming an alert indicator for specific time frame when the chart e.g create a low followed by high low then continues to form higher high, pulls back to retest the high low. The program must sound when market retest the high low or send an email. Meaning on a downtrend the chart will form a high then form a higher low followed by lower low, when chart retest higher low the program should sound or send an email
Thanks for this amazing tutorial!
Why is it currentBar-count and not currentBar-count+1? currentBar+1 takes currentBar one bar leftwards (so, if the index of currentBar is 10, it will be 11) and currentBar-count takes currentBar five bars rightwards (so, if currentBar is 10, it will be 10-5 = 5), so I think in this way the currentBar-count is one bar a head of currnetBar+1. Where am I missing the point?
The function with your example is looking for a bar with 5 (say lower) to left and right. That means bars 5-9 must be lower and also bars 11-15. So start bar is 10-5 for a search distance of 11
Thanks for this Mr Orchard.
Please, how are we going to create High1, High2, Low1, and Low2 in order to be able to use this function for buy or sell entry? For instance, say,
if H2 > H1 (BuyEntry).
In this case, H1 is the Peak1 and High2 os the Peak 2.
Does everything in the findpeak functions = H1/H2/L1/L2 ?
I would be more than happy of I get a solution to ghis questions.
Thanks for the training once again.
I'm not sure what is being asked. The functions find H1 and H2, so if you want to trade based on relative values then just compare them.
Sir, I meant; how will I say
if(Peak2 > Peak1) ?
What would be my Peak1
@@OrchardForex I've rematch the video and gotten what you mean sir. I've watched the video more than going to 10 times though
@@OrchardForex Do you have any free group or community for your students sir, I would like to join pls?
@@OrchardForex I tried to compare Bar1 and Bar2 but it doesn't work when I tested it. Pls what am I doing wrong sir?
Thank you very much. Yet again works fantastically. One question would be. I was drawing the D1 Trendlines with the script, and when changing to the 5M TF, the trendline remains on the start of the day instead of being on the actual low that occurred during that day.... Is there an easy fix to this?
And a big thank you again for the videos, very easy to understand.
This is a script. It won't run again automatically when you change timeframe.
@@OrchardForex Yes true, I missed the point that I converted it into an indicator, and hence my question above.
Dear great Mr.Ochard
Please make multiple videos on how to make all the pattern in codes
Like head & shoulders
Widgets ( Raising & falling )
All the technical patterns please
Thanks in advance MQL King
I'll see what I can do
Hello Sir, how to get highest and lowest price after trade begin / open order? Thanks..
How we identify the break of structure on impulse plzz make a code in mt5
Excellent work, would you please show us how to write a code or an expert advisor that draw fib level
Showing us when price is in uptrend and when is in down trend
Interesting video.
So how does one create an ea or indicator using zig zag to find out if the previous candle broke and closed below or above the previous zig zag high or low point?
zig zag is a repainting indicator. You have to remember the previous value in code.
Thank' you
Welcome 😊
What if peaks and lows are not based on iHighest, iLowest functions, but on a price shift? Meaning, if for a candle number 15 the price moves lower for 40 pips on both sides of the chart, then we consider High[15] as a swing Peak.
Then that is not what this video is about.
For some reason I'm getting these errors for lines 20 and 29
'ObjectDelete' - no one of the overloads can be applied to the function call
could be one of 2 function(s)
built-in; bool ObjectDelete(long,const string)
built-in; bool ObjectDelete(const string)
That's exactly the format I have in the original code. You have mistyped something.
@@OrchardForex I don't see any typos. This is exactly what is there...
Line 20:
ObjectDelete(0, "upper", OBJ_TREND, 0, iTime(Symbol(), Period(), bar2), iHigh(Symbol(), Period(), bar2), iTime(Symbol(), Period(), bar1), iHigh(Symbol(), Period(), bar1));
Line 29:
ObjectDelete(0, "lower", OBJ_TREND, 0, iTime(Symbol(), Period(), bar2), iLow(Symbol(), Period(), bar2), iTime(Symbol(), Period(), bar1), iLow(Symbol(), Period(), bar1));
@@JsontheBarber That code is from the ObjectCreate function
@@OrchardForex thank you! I don't know how I over looked that for 2 hours straight. .. (probably just looking too hard)
Thanks A Lot, I am awaiting this type of code. Now can we use this code for Auto Trading .
Yes you can. That's why I coded it as a function.
@@OrchardForex Sir Thanks A Lot , I have made a indicator , which projection of new bar from M15 to Weekly high low , and make it free for MQL5 Community , you can convert it to expeert . if you permit me i will send you coode. Thanks .
❤❤❤
Could you kindly share the link to the code of the MQL Code?
Thanks a lot sir, please can you post RSI divergence video
Please help sir with finding previous high or low only
Can you please teach how to make a web socket connection from mql4 to a php server so it can send and recieve data?
Will u b able to extend this code to see if the price crosses these lines..
I don't plan to do that.
Excellent lesson. Thank you once again. I am having problem with OrderSelect() function returning error 0 and leading my EA to believe that there is no open order opened by it. This happens mainly when I have another instance of this EA running on a different pair. I use different magic numbers for each instance. Please make a lesson on how to solve this. Thank you.
OrderSelect returns a boolean indicating select was successful or not. It has no filters to select by symbol or magic. It appears you may be using OrderSelect incorrectly.
🙏❤
Thank you
Nice...
Thanks
Gosh tell me someone where this music is from before I get totally crazy :) I do not get it
Hello, I am writing my own version of this but in the form of an indicator. When filling the line buffer I keep getting array out of bounds. I am resizing the array to be the size of rates_total + 1 on each on calculate call but I am still getting the error. Is it possible to do a tutorial on how to create an indicator when using the coppybuffer function is not applicable?
Have you tried just printing the index value you are using when you get array out of bounds?
Hi Sir,
I have complied the script, it has error stating the FindNextPeak is not defined.
Pls advise.
Thank you.
I can only assume that you have a typing error somewhere in the FindNextPeak function name.
owsem😇
Thank you
Can we identify the divergent using the awesome oscillator with code?
Sure, why not?
@@OrchardForex can you share some tutorial example ? 🙏🙏
Can you make a video of an EA which place order only once per candle
Does this help ua-cam.com/video/Ip7BBPe8mwA/v-deo.html
@@OrchardForex it doesn't help, if you can please make a simple EA which can trade every candles but the moment it's either buy or sell it stops trading until new candle appears.
Sir please how can o turn it into an indicator
This just gives values. You need to know what you want to do with them before they can be used in an indicator.
how can one parse this into an mql4 EA? i'm getting errors.
The same functions will work in EA, Indicator and Script.
@@OrchardForex it worked perfectly, thank you.
Not good. He finally tests something that is good. But he never mentioned and shown the time of the second point of the line.
Sorry you don't like my content. Everything in the functions is shown in the video. What you do with it is up to you
Why do you need to rewrite Zigzag indicator?
0:00
I found this interesting and I'm backtracking it in my EA. can you please write an array function to include the last 10 upper and lower points. Thank you
Can copy to mql4?
Yes, the same code works for both MQL4 and MQL5
Perez Thomas White Helen Davis John
Can you write an indicator for me in MQL5 if i give you the logic?
I have troubles adding this to my EA! Can anyone assist me? I am new to code so this is kind of a problem for me… @orchard forex do you do small jobs i don’t have much but can pay something
This script calls functions to find high and low points. You can just copy the function into your EA to do the same there but how you use the function depends on what your EA plans to do. The lines the script draws are really just for display.
@@OrchardForex how do i use an And or a Or when adding it to buy conditions
@@makeit707 I'm not sure what you are asking. This function just finds high and low points. You would need to have a way of using that in your expert. For example if h1 is the most recent high value from the function and h2 is the high before that, and you have similar l1 and l2 for low points, you might want to buy if h1 is higher than h2 and l1 is higher than l2. A traditional higher highs and higher lows. In that cast the and coudition would be if ( (h1>h2) && (l1>l2) ). For an or condition you still need to decide what you are testing then use || instead of &&
@@OrchardForex what i am aiming for is if current candle is higher than higher point and candle(1) is a bear OR candle(2) is a bear than buy, thats what i am battling with the OR
@@makeit707 So you use the function to get the recent high point, say you put that in double recentHigh. Then you have current price in a variable like double price. And for candles 1 and 2 you have open and close prices like open1, open2, close1, close2. A bear candle is where close