Hello, I was looking for an example to code a grid, as a 1st level of recovery for my EAs, and I found your Channel. It's fantastic ! I'm starting with MT4, but I've some capabilities in C++. I love your clean code writing. It's a 2 Years video but so useful, and perfect for me, thank you so much. Take care.
Thank you very much. To even make the EA more robust, I added a condition to close the trades as a basket if the trade is going the opposite direction and I have lost a particular amount of money. Running this EA as it is without this extra condition makes it appear like a Martingale strategy and it will get to a point where one will lost all the money in one's trading account.
but this code is for education purpose not for trading with your real money, if i am correct! About the martingale, there have been extensive research done and martingale can be profitable if modified properly and also if managed properly.
This script is only aiming to close all trades when the combined profit reaches a given target. The EA does place trades but it is only an example EA to test the closing process. What you are looking for is an algorithm to imcrease the size of new trades, I assume as you move further out of the money, in a martingale style. Not too difficult but it needs more than just a comment to respond.
Thanks you so much for Effort it really worth commending, I found most of those programming Tutorial compile in your video but in reality it doesn't or Error coding happens. [ sample : Buy and sell arrow programming ] there are errors which I knew it were imputed to create traffic in compiling , I traced it only to find many more I observe your LEVEL OF CODING IS EXTREMELY HIGH TO DECTECT IT. (Probably HIDDEN Secret ) Please we love you for your works and knowledge. apply charges to any video worth charging. For those who really want to learn the Mt4/5 coding so thorough Tutorial without hidden secret . We love you ❤️❤️
Following your steps in creating many of those things you did Prove abortive to many who cant differentiate and navigate themselves. I wish you come out more Plain in your tutorials ,and not hiding Valid steps in your tutorials Thanks cheers
Thank you so much for awesome video. How can I compare and close first last order? Meaning when EA opens 5 orders, compare 1st and 5th orders, close when they are in profit, likewise compare 4th and 2nd order, close when they are profit. Instead of closing all together, how can i close in this way? Can you please guide me how to do these?
Time would be the close time of the trade. Most brokers add SL or TP to the comment on closing the trade. Try that, or just check if the close price matches the SL or TP price.
I follow well your EA for mt4 and Mt5. I can remark that only Buy position is activated but Sell position can not run in your video why? Can you please explain the issue? Thanks
Average profit will only make sense if applied independently to buy and sell, not by netting them together. The easiest way to adapt this then is to just load the expert twice.
Loading them together is working fine for the last couple of days but I can only do that in a demo/live account. I just need to test the strategy on strategy tester. but ofcourse with some minor adjustments "we ll talk about that if you agree to make the EA :) "
Morning. Firstly, the basket-close is a great tool for pushing volume. I have question though, if I want the executed deals to be the InpTradeGap apart from each other, how do I do that? Currently it executes on each tick which gets a little rough if the MaxOrders are high.
Thank you very much for your good efforts , When converting to MQL5 you didn't calculate the commission value when calculating the profit , is there a fix for that ?!
I thought I mentioned it in the video, maybe not. I didn't include commission because I can't be sure what it is. In MT4 all commission is charged up front. In MT5 a trade has 2 parts, open and the opposite to close. Brokers can charge commission on either side or both and you don't know the total until the trade is already closed. Now, my view, MQL5 looks like it was designed by the work experience kid. I do work for corporates, high value traders, and they won't touch it. It seems all the popularity of MT5 is with gamer kids who think from the name that it is a new version but it is no more a new version than a 747 is a new version of a 737.
Hey, I am sure you are aware as you are the mql god but in this video you said the order send should be checked just tells you that you should make sure that it executed properly, but when i have gotten that code i have been able to clear it by assigning it to a variable. i think it just wants to make sure you havent just tossed out that number for later reference
You are not "clearing" it. The compiler wants to make sure you do something. You can catch in a variable and use the ticket later. All I wanted to do was ignore the warning here.
Thanks for your hard work,may I ask you instead of 10 max order at random ,how can it buy or sell 2 different SPECIFIC assets /forex pair in equal amount,like 5 pairs of euro/usd and 5 pairs of gbp/usd ,is it possible?? Thanks
This video was about the functions to handle averaging. The expert is just a wrapper to test and demonstrate. You can make the expert into anything you like.
This is great, I wanted to ask if there’s a way to decode an ea and creat it yourself. There’s a guy I bought an ea from and it’s not working. It seems he has given me one with an expired licence and I can’t get ahold of him no more. He took me for a ride
If you search the internet you will find many people offering to decompile your code for a fee. I have not seen any indication of this being done successfully for a long time
Thank you so much sir for your kindness. I followed through with this code. But it doesn't work on my mt5 when I tried to backtest it. I am trading synthetic indices. Please what do I do? Thank you always
@@OrchardForex Thank you for your message Sir. I think I would need a walkthrough on how to use it. Tried it with strategy tester on a demo account but it doesn't enter multiple trades. Could you pls work me in it or direct me on a video to watch pls?
@@danielosaswilson5894 This video is about closing trades. The entries are just there to create some trades to close and any of your settings could be causing the problem. The code is shown on the website, just compare it to yours.
10:48 why do you pass as &sum and not just sum? Also, couldnt the variables count, profit, trailPrice just have been declared as separate variables, rather than in a struct? not seeing the point of the struct STradeSum, seeing as we are not saving any other sets of those variables. Thanks for the video
using &sum because structures must be passed by reference. Benefits are not just when using multiple copies. It's much easier to pass a single variable around than multiple and if I decide in the future to add more elements I don't have to change the function signatures.
@@OrchardForex thank you for your reply. you have given me some programming concepts to study. I am fairly new to programming below are notes to myself: 1. Passing by reference - passing the address of the memory where the variable is stored, so that the variable can be updated by the function that is passed. 2. Function signature - A function signature includes the function name, its arguments, and the return type (ah so thats the name of that thingy) keep up the great work! it is great that you present real, technical videos, without any fluff or b.s. You are one of the few real ones on YT
Hello. I've tried to merge the tutorials on your youtube: RSI for MT4 EA for MT4 to make and close trades on average profit target. But the basket system only works to buy positions. May i send the file to you to review it?
Master, how to Debug an EA??? OnInit??? EA is working fine but if u change any inputs when the EA is running and press ok... it goes on forever and I have to restart the MT4 to make it work... Can u help us??? Thanx
If you change the inputs the EA will restart. Add some print statements to the oninit and track it through the log. You probably have a loop that doesn't end.
We all learn differently and it would be a very bad educator who recommends a single best method. My technique is to set objectives for myself that are just beyond my understanding and then solve by research the problems to reach the objective. Repeat.
@@wamashudunetsianda974 Then the video I listed shows how to watch for changes in trades. Just wait until your trade closes then open the new trade as you need. I have another video coming that has an improved technique but not scheduled for a few weeks yet
Hi Sir, on my Scripts I do have some error - { unexpected end of program don't know why, I did exactly what you teach on video, on script 34 void On Tick() { then error will show
I can see there is many Ea you are make it, with out stop loss and take profit. Are you not scary about the network, markedet , your computer goes down, and the position not will be closed..?
Hello. I've tried to merge the tutorials on your youtube: RSI for MT4 EA for MT4 to make and close trades on average profit target. But the basket system only works to buy positions. May i send the file to you to review it?
Thanks to this man i have made mql programming a hobby. I wish you well sir more wealth and life. You are doing a good job you are changing lives.
Thank you. I hope your new hobby goes well for you.
This is one of the very best MQL tutorial channels on the whole of UA-cam. Thanks a lot.
Glad you think so!
Hello, I was looking for an example to code a grid, as a 1st level of recovery for my EAs, and I found your Channel. It's fantastic !
I'm starting with MT4, but I've some capabilities in C++. I love your clean code writing.
It's a 2 Years video but so useful, and perfect for me, thank you so much. Take care.
Thank you
Thank you very much. To even make the EA more robust, I added a condition to close the trades as a basket if the trade is going the opposite direction and I have lost a particular amount of money. Running this EA as it is without this extra condition makes it appear like a Martingale strategy and it will get to a point where one will lost all the money in one's trading account.
may you please email me the code
but this code is for education purpose not for trading with your real money, if i am correct! About the martingale, there have been extensive research done and martingale can be profitable if modified properly and also if managed properly.
Hey do you still have this code?
EXCELLENT TUTORIALS THANK YOU FROM THE BOTTOM OF MY HEART!
Glad you liked it!
Woow! Thank you my motivation! This is like martingale. But is great because if one makes it with their own indicator it can win mostly.
You are a great a genius man.... I made million dollar through your EA...,,,, ❤️💕❤️💕
Very excited video.
Really appreciate your excellent vids, thank you!
Glad you like them!
Great it's short and sweet 🙂
Great content sir. How do you increase the lot size on different gaps instead of the same lot size throughout?
This script is only aiming to close all trades when the combined profit reaches a given target. The EA does place trades but it is only an example EA to test the closing process. What you are looking for is an algorithm to imcrease the size of new trades, I assume as you move further out of the money, in a martingale style. Not too difficult but it needs more than just a comment to respond.
@@OrchardForex Alright, thanks sir
Thanks you so much for Effort it really worth commending,
I found most of those programming Tutorial compile in your video but in reality it doesn't or Error coding happens. [ sample : Buy and sell arrow programming ]
there are errors which I knew it were imputed to create traffic in compiling , I traced it only to find many more
I observe your LEVEL OF CODING IS EXTREMELY HIGH TO DECTECT IT. (Probably HIDDEN Secret )
Please we love you for your works and knowledge.
apply charges to any video worth charging. For those who really want to learn the Mt4/5 coding so thorough Tutorial without hidden secret .
We love you ❤️❤️
Thank you. For the time being I have no plans to charge for these videos so ... enjoy.
Following your steps in creating many of those things you did
Prove abortive to many who cant differentiate and navigate themselves.
I wish you come out more Plain in your tutorials ,and not hiding Valid steps in your tutorials
Thanks cheers
Thank you so much for awesome video. How can I compare and close first last order? Meaning when EA opens 5 orders, compare 1st and 5th orders, close when they are in profit, likewise compare 4th and 2nd order, close when they are profit. Instead of closing all together, how can i close in this way? Can you please guide me how to do these?
Thank you for another awesome video. Is there any way to show the horizontal line showing the target price where it will close?
Yes but too much for a reply. The target price can change with swap changes.
thank you very much. sir, i would like to request, since this is only a but trade. make a video with both buy and sell are in this code. thank you.
The example was for buy but the code is already for both
thanks a lot , very helpfull content
THANKS, i learn a Lot with this vídeo. THANKS.
You are welcome!
Orchard, I need your help again!
Could you make a video explaining how can I check if SL or TP is hit and the time when occurs?
Time would be the close time of the trade. Most brokers add SL or TP to the comment on closing the trade. Try that, or just check if the close price matches the SL or TP price.
@@OrchardForex thanks for you attention master!
I follow well your EA for mt4 and Mt5. I can remark that only Buy position is activated but Sell position can not run in your video why? Can you please explain the issue? Thanks
That help me a lot, thank you
You're welcome!
Hello Sir, can you please make a video on how to do the same idea but with buying and selling at the same time...thanks :)
Average profit will only make sense if applied independently to buy and sell, not by netting them together. The easiest way to adapt this then is to just load the expert twice.
Loading them together is working fine for the last couple of days but I can only do that in a demo/live account. I just need to test the strategy on strategy tester. but ofcourse with some minor adjustments "we ll talk about that if you agree to make the EA :) "
@@MohammadAdel2903 The 2 legs would be independent, you could just run strategy tester twice. I am not available to work on this as a custom expert.
Morning. Firstly, the basket-close is a great tool for pushing volume. I have question though, if I want the executed deals to be the InpTradeGap apart from each other, how do I do that? Currently it executes on each tick which gets a little rough if the MaxOrders are high.
See 5:35
Thank you very much for your good efforts , When converting to MQL5 you didn't calculate the commission value when calculating the profit , is there a fix for that ?!
I thought I mentioned it in the video, maybe not. I didn't include commission because I can't be sure what it is. In MT4 all commission is charged up front. In MT5 a trade has 2 parts, open and the opposite to close. Brokers can charge commission on either side or both and you don't know the total until the trade is already closed.
Now, my view, MQL5 looks like it was designed by the work experience kid. I do work for corporates, high value traders, and they won't touch it. It seems all the popularity of MT5 is with gamer kids who think from the name that it is a new version but it is no more a new version than a 747 is a new version of a 737.
Hey, I am sure you are aware as you are the mql god but in this video you said the order send should be checked just tells you that you should make sure that it executed properly, but when i have gotten that code i have been able to clear it by assigning it to a variable. i think it just wants to make sure you havent just tossed out that number for later reference
You are not "clearing" it. The compiler wants to make sure you do something. You can catch in a variable and use the ticket later. All I wanted to do was ignore the warning here.
Nice...
Can you make multiplier lots??
Do you mean adding more trades when in profit?
@@OrchardForex
I mean martingle with lots multiplier when in loss
Thanks for your hard work,may I ask you instead of 10 max order at random ,how can it buy or sell 2 different SPECIFIC assets /forex pair in equal amount,like 5 pairs of euro/usd and 5 pairs of gbp/usd ,is it possible?? Thanks
This video was about the functions to handle averaging. The expert is just a wrapper to test and demonstrate. You can make the expert into anything you like.
Excelente video
Thank you
This is great, I wanted to ask if there’s a way to decode an ea and creat it yourself. There’s a guy I bought an ea from and it’s not working. It seems he has given me one with an expired licence and I can’t get ahold of him no more. He took me for a ride
If you search the internet you will find many people offering to decompile your code for a fee. I have not seen any indication of this being done successfully for a long time
Really helpful thank you
Glad it helped
Orchard Forex the best tutorials, I am learning Mql4, Do you have any tutorial where you explain how to add lot to the last order?
Do you mean a pending order or to a live trade? You can't add lots to an existing trade.
@@OrchardForex Add lots to next order pending, Example: order 1, 1 Lot; order 2; 3 lots; with a multiplier; Intvolumen(last order) * Intmultiplier
@@forexlife9883 So you are averaging in with a martingale factor
@@OrchardForex Do you have a tutorial on how to make martingale Arithmetic or exponential?
Thank you so much sir for your kindness. I followed through with this code. But it doesn't work on my mt5 when I tried to backtest it. I am trading synthetic indices. Please what do I do? Thank you always
Saying it doesn't work gives no information to help. You will have to go through debugging to find the error.
@@OrchardForex Thank you for your message Sir. I think I would need a walkthrough on how to use it. Tried it with strategy tester on a demo account but it doesn't enter multiple trades. Could you pls work me in it or direct me on a video to watch pls?
@@danielosaswilson5894 This video is about closing trades. The entries are just there to create some trades to close and any of your settings could be causing the problem. The code is shown on the website, just compare it to yours.
@@OrchardForex thank you so much Sir for the explanation. Blessings Sir
Please could you show me how to code an ea that multiplies entries at one click of a button?
10:48 why do you pass as &sum and not just sum? Also, couldnt the variables count, profit, trailPrice just have been declared as separate variables, rather than in a struct? not seeing the point of the struct STradeSum, seeing as we are not saving any other sets of those variables. Thanks for the video
using &sum because structures must be passed by reference. Benefits are not just when using multiple copies. It's much easier to pass a single variable around than multiple and if I decide in the future to add more elements I don't have to change the function signatures.
@@OrchardForex thank you for your reply. you have given me some programming concepts to study. I am fairly new to programming
below are notes to myself:
1. Passing by reference - passing the address of the memory where the variable is stored, so that the variable can be updated by the function that is passed.
2. Function signature - A function signature includes the function name, its arguments, and the return type (ah so thats the name of that thingy)
keep up the great work! it is great that you present real, technical videos, without any fluff or b.s. You are one of the few real ones on YT
@@henryh2957 That's correct. This might help with passing by reference: ua-cam.com/video/zeZqaWpFpXY/v-deo.html
did something similar to this on mt4 but used limit orders instead
That could also work.
Good Morning Sir, I am Jiva From India. I needed a Code that can repeat my trade by itself once the stop loss is hit or target is hit. plz guide me
If all you want to do is place a new trade each time a trade closes at sl or tp then you are doing nothing but giving away commission.
@@OrchardForex Yes sir, I agree but am sure about my strategy. Plz help me find EA for simply repeating the Same trade.
Hello. I've tried to merge the tutorials on your youtube:
RSI for MT4
EA for MT4 to make and close trades on average profit target.
But the basket system only works to buy positions.
May i send the file to you to review it?
I'm afraid not, I can't do 1:1 support
Sir, could you help with Sell scripts too?
That's already in the video
hello, how can I make it perform sell entries? how to change the InpType?
It's on the inputs screen when you first load the expert
@@OrchardForex Thanks!
Sir, it only takes buy trades. Can sell trades be taken?
That is explained in the video
Master, how to Debug an EA??? OnInit??? EA is working fine but if u change any inputs when the EA is running and press ok... it goes on forever and I have to restart the MT4 to make it work... Can u help us??? Thanx
If you change the inputs the EA will restart. Add some print statements to the oninit and track it through the log. You probably have a loop that doesn't end.
How to fast learning programming sir im understand for logic but im not make build script 😣
We all learn differently and it would be a very bad educator who recommends a single best method. My technique is to set objectives for myself that are just beyond my understanding and then solve by research the problems to reach the objective. Repeat.
now i can understand what you wrote uncle thank you for being our teacher
HOW TO ADD LOT MULTIPLIAR STARATAGY IN THIS CODE
You could just multiply by number of open positions.
How to make EA open another position when tp or sl has been hit
Depends what you are doing but you probably need to monitor the open trades. Try this video ua-cam.com/video/G4qYbqTj2oM/v-deo.html
@@OrchardForex if for example the is a buy pending order with sl and tp, I want my EA to open buy trade if tp is hit or sell when sl hit.
@@wamashudunetsianda974 Then the video I listed shows how to watch for changes in trades. Just wait until your trade closes then open the new trade as you need. I have another video coming that has an improved technique but not scheduled for a few weeks yet
@@OrchardForex ok, thanks for your time.
how to solve this "Average Profit EURUSD,M1: trade operations not allowed by settings" ? :(
You probably haven't enabled auto trading
How can set average profit in point or pips? Please give the code i want to use average profit in point or pips
That would just mean using price difference to calculate average but I'll add this to the topic backlog.
@@OrchardForex i was send you mail from your website. Please send me the code i want to learn.
@@OrchardForex Sir please add the code
How to close after a loss, is that possible
Basically reversing the logic so that when total profit < some limit amount close everything.
Hi Sir, on my Scripts I do have some error - { unexpected end of program
don't know why, I did exactly what you teach on video,
on script 34 void On Tick() {
then error will show
You are probably missing a closing bracket somewhere
@@OrchardForex Ton Of Thank you.!
On this EA can I set up multi Basket or Multi Layer ? Need your extrema Help Sir , PLEASE
@orchard I have an idea for a EA ,would you be interested in coding it?
If you have a well defined and documented strategy you could suggest it on Discord as a strategy review topic. orchardforex.com/discord/
@@OrchardForex thanks, I have the discord App will chat.
I can see there is many Ea you are make it, with out stop loss and take profit.
Are you not scary about the network, markedet , your computer goes down, and the position not will be closed..?
The purpose of the videos is the programming.
hi download link not working?
That would be because there is no download link. Just copy the code from the blog
This man litterly applied the statement which say "Dont give me a fish but teach me how to catch a fish"
Dans le trading exist un danger
Le slippage
Le seul gagnant est le broker
Svp arreter de trader le vide et invistire au reel acheter de l'or ...
Hello. I've tried to merge the tutorials on your youtube:
RSI for MT4
EA for MT4 to make and close trades on average profit target.
But the basket system only works to buy positions.
May i send the file to you to review it?
I'm afraid not, I can't do 1:1 support