Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1494
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
Select the period on which you want to run your data. And then on the tab of the obtained parameters, right-click on the desired one and select single test.
Thanks.
And how to do everything in the scope, and not poke at each parameter?
Could you please help me with the calculations?
I need to have a take profit 3 times the stop. It seems to work, but something is wrong)). The robot trades on gold and indices, but refuses to trade on currencies (although it calculates everything correctly).
First I set the stop on the low of candle 1:
Then I calculate the distance from ASK to the stop in points, and assign this value to the pert points:
After that I calculate the stop also in pips:
Then I open a deal and add TR to the ASK :
And in the tester all calculations are correct, in 5-digit points, the stop is also on Low1, the size of the stop is also correct in 5-digit points. But there is something wrong with the take profit, it is not 507 pips, but 5070 pips.
Hello, Sergey.
When calculating the stop, you go from the distance in price to the distance in pips. Then, multiplying by 3, you get the distance to takeout also in pips. And then you add the number of pips to the ask price.
Try not to divide by the size of one pip or then remember to multiply by it again.
Or like this
Hello, Sergei.
Thank you very much! Really got lost in the prices/items. I'll try it now)))
Now everything is counted and set correctly, but only on USDJPY, XAUUSD and any index. But on currencies like USDCAD, EURUSD the owl does not trade and sends error 4756. I looked up the value in the help, but it did nothing)
Do like in the previous post: provide the code that opens positions for you. Then, perhaps, you will be able to give some advice. There should not be any fundamental difference between USDJPY and USDCAD, most likely there is some trivial error.
Do as in the last post:
Here is the code
Most likely the error is here:
According to your logic maHandle should be the price, and this is most likely a handle, i.e. an integer - the serial number of the indicator among all loaded indicators. Look in the MQL5 Help for the correct way to get indicator values.
There's probably a mistake here:
According to your logic maHandle should be the price, and this is most likely a handle, i.e. an integer - the serial number of the indicator among all loaded indicators. Look in the MQL5 Help for the correct way to get indicator values.
I thought the same thing in the evening, that I should remove it. I haven't made friends with indices yet. I just vaguely remember that in 4 I just wrote that Close > MA and everything worked there. I'll try commenting out the handle and see what the results are
That's what I was thinking tonight, too, that I should put it away. I haven't made friends with the indices yet. I just vaguely remember in 4 just writing that Close > MA and it worked there. I'll try commenting out the handle and see what the results are
I was once recommended to "make friends" with MetaEditor debugger. After I got more or less acquainted with the debugger, 99.9% of questions disappeared by themselves. You put any variables in the observation and see their values, then compare them and understand where in the code there is a problem. It is a very convenient tool. I recommend it.
Regards, Vladimir.