Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1401
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
Hi all, can you please help me to add martingale to EA, I need after triggering stoploss (getting loss) and on new signal (owl works by indicator) to enter with increased lot (multiplied by coeff). Did I get it right, first I need to write the event - stoploop event (I don't know where and how), and do the maths with lots there (I need additional variables)?
For example, add a variable - counter of losing trades in a row. At each losing trade - increased by 1, at each profitable - reset to 0.
And from this counter set lot (for example - multiplying the minimum lot by 2 in proportion to this counter).
But martingale will not make a losing strategy profitable.
For example, add a variable - counter of losing trades in a row. At each losing trade - it is increased by 1, at each profitable - it is reset to 0.
And from this counter set the lot (for example, multiply the minimum lot by 2 to the extent of this counter).
But martingale will not make a losing strategy profitable.
Thanks, the strategy has an average of 2 and a maximum of 4 losses in a row, that's why I wanted a martin. By the way does anyone have an example of such a counter or owl working on the same principle as I described? I could just copy the necessary lines from there.
Can you tell me why the first option works and the second doesn't? Can't the name of the button be set to a variable?
How can the tester automate the passing of several pairs?
For example, I need to go through 20 pairs. Now I restart the tester for each pair.
I can't figure out how to make a variable.
Are there any solutions?
How can the tester automate the passing of several pairs?
For example, I need to go through 20 pairs. Now I restart the tester for each pair.
I can't figure out how to make a variable.
Do you have any solution?
Forum on trading, automated trading systems & strategy testing
How to receive selected pairs for market review in Strategy Tester?
Alexey Viktorov, 2022.04.14 17:11
You cannot use the MarketWatch terminal in the Strategy Tester. The tester generates its ownMarketWatch from the symbols whose properties have been requested from the program. Therefore, to form aMarketWatch, you need to request any property of the required symbol.
I hope I didn't make mistakes when pulling code from my program...
How can the tester automate the passing of several pairs?
For example, I need to go through 20 pairs. Now I restart the tester for each pair.
I can't figure out how to make a variable.
Are there any solutions?
If we define a pair by an EA parameter which may change during optimization, then we simply run optimization by this parameter to start a pass through several pairs.
This parameter cannot be of 'string' type, but it can be of 'int' or 'enum' type.
Using this parameter, when initializing the EA, we assign to another string variable the name of the desired symbol that corresponds to the value of the parameter.
In the EA code, you will have to replace Symbol() or _Symbol with your own variable with the name of the pair.
Do you understand the principle or do you need a code example?
How can the tester automate the passing of several pairs?
For example, I need to go through 20 pairs. Now I restart the tester for each pair.
I can't figure out how to make a variable.
Are there any solutions?
Sabermultitester is a solution, you can set up passes there by tools and settings.
If a pair is defined by an EA parameter that can be changed during optimization, then in order to run a multi-pair pass, we simply run the optimization by this parameter.
This parameter cannot be of 'string' type, but it can be of 'int' or 'enum' type.
Using this parameter, when initializing the EA, we assign to another string variable the name of the desired symbol that corresponds to the value of the parameter.
In the EA code, wherever Symbol() or _Symbol is used, we will have to replace it with our own variable with the name of the pair.
Do you understand the principle or do you need a code example?
Great! It didn't occur to me to go through the optimizer.
If a pair is defined by an EA parameter that can be changed during optimization, then in order to run a multi-pair pass, we simply run the optimization by this parameter.
This parameter cannot be of 'string' type, but it can be of 'int' or 'enum' type.
Using this parameter, when initializing the EA, we assign to another string variable the name of the desired symbol that corresponds to the value of the parameter.
In the EA code, wherever Symbol() or _Symbol is used, we will have to replace it with our own variable with the name of the pair.
Is the principle clear, or do you need an example code?
What about OnTick() ?
I can substitute my own symbol everywhere, butOnTick() will always be taken fromthe symbol on which the tester is running.
From help: "The OnTick() event is generated . when a new tick is received for a symbol, to the chart of which the Expert Advisor is attached".
There can be no conflict here? For example, forex is stopped out over the weekend but crypto is not.