[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 686
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
itum:
How to solve this problem ? Ga
Do condition handling only once at the beginning of the bar.
Alternatively, run a flag that is set if an order is placed and reset when conditions have changed significantly.
Уважаемые програмисты.
Please tell me what to insert (and where to insert it, if possible) in the code to make the EA open a position with the previous lot multiplied by 2 if the previous trade was losing.
Thank you very much.
I just want to ask you a question: What should I do if I want to open a position with this EA?
Roger:
Ищите советники с кодовым названием Мартингейл.
I've been looking for one but it doesn't work for me.
I found one that should double a lot if a previous trade was losing, but it does not want to work.
This probably means that if you are offered code here, you still won't be able to insert it into your EA yourself, right?
No, it means that the EA was not working, and I cannot find a working one with the piece of code I need.
Check it out, https://www.mql5.com/ru/forum/104481
No, it means that the EA was not working, and I can't find a working one with the piece of code I need.
In the global variables set the initial value of the lot:
There we assign this value to the variable, which will pass the lot value to the position opening function:
double Lots_New = Lot;
After closing the position, let's check it for profit/loss:The function itself, thanks to Igor Kim...
cyclik33:
Dear programmers.Please, advise me what to insert (and where to insert it if possible) in the code to make the EA open a position with the previous lot multiplied by 2, if the previous trade was losing.
I thank you in advance.
Boris.
Boris, it's not hard at all, here's a simple function that implements the martingale principle:
Pass the initial volume(double lot), and the step(double x) as parameters.
Insert the method directly into OrderSend instead of the volume parameter.
Example of a function call: