Questions from Beginners MQL4 MT4 MetaTrader 4 - page 130

You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- 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
Do you use debugger to find your errors?
No. Less than 1 week programming experience. I took an example of a simple EA and tried to add SL, TP, TStop and TStep to it. It says no errors after compiling (see above screenshot) but in fact (in the tester) these functions don't work.
Please advise what I need to do. And how to proceed.
No. Less than 1 week programming experience. I took an example of a simple EA and tried to add SL, TP, TStop and TStep to it. It says no errors after compiling (see above screenshot) but in fact (in the tester) these functions don't work.
Please advise what I need to do. And how to proceed further.
I do not want to steal from you. I don't want to rob you of the very useful experience of searching for your own mistakes.
Mistakes are an inevitable thing, even in professionals.
It is very important to be able to find them if you want to continue programming.
The Metaeditor has an indispensable tool called "Debugging".
Spend time and master this tool, and you will not have to ask others on forums to look for your mistakes.
You need to go through the program step by step, controlling the required variables and what happens in them.
With the help of this tool you can not only find your own errors but also understand peculiarities of some functions.
You can read the information here or see the MetaEditor's help.
You can read this article.
Hello, friends, help me solve the following problem: I am trying to write a simple Expert Advisor and was faced with the following: if the SL is set to a value different from 0, then trades are not opened at all, as well as the TP, TStop and TrailingStep do not work at all.
What should I fix in the code?
For setting the Stop Loss and Take Profit levels the real price value is used. While in your code these values are not real. For example, if SL equals 50 for EURUSD, we will get the value of 0.0005. For a Buy order, the Stop Loss is still correct (even though it is not meaningful), but it is an error for a Sell order since it should be higher than the open price. If the current EURUSD price is 1.25, the Stop Loss value should be above that level.
Also, do not forget to check the obtained values of Stop Loss and Take Profit for closeness to the market, comparing them with the Stop Level.
Hi, I can't find a function that returns a ticket of the furthest away from the market position. Could you post it please, who has it?
You will find a lothere.
You will find a lothere
Thanks, Vitaly, but that's where (and not only) I was looking. Unfortunately there are not all the functions I need:
-returnsticket farthest from market position (by magic and direction) Or earliest
-Returnprofit for the ticket
-closesposition in the ticket
Can you tell me where to get one, if you know it
Thanks, Vitaly, but that's where (and not only) I was looking. Unfortunately, all the functions I need are missing:
-returnsticket furthest from market position (by magic and direction) Or earliest
-Returnprofit for the ticket
-closesposition in the ticket
Tell me where to get it, if you know it.
There's a ticket for the closest one. How to find the furthest - I think you can guess. If you have found the ticket, you can work with it if(OrderSelect(ticket, SELECT_BY_TICKET)) { ... }
Hello! I am making an Expert Advisor according to two conditions! Well, the first condition should work on m15 and the other one on n4!!! Can you tell me how it can be done?
Take data from different TFs. For example, opening price of the current bar on different TFs (values will only match the first 15 minutes of the H4 bar):
The most difficult moment when working with different TFs is data synchronization. Because the numbering of bars on different TFs is different.