Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1594

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
thanks
But in this function: double GetProfitFromStart()
yellow is just the name of the function, am I right?
and in principle it can be anything?
Yes, I named it that way to make it clear Get Profit FromStart
Thank you.
In Expert tick function
void OnTick() - it turns out that the code line : if(CountOrders()==0&ObjectGetInteger(0, "lab_Button",OBJPROP_STATE)) is not only the first order trigger when the EA is initially started
but also each run after the order has been closed according to a condition:
do I understand it correctly?
the amount of loss on all losing orders
I must have misunderstood again
or the amount of loss on each losing order
or the cumulative loss on all losing orders...
If you need only a single print, you'd better do it as a script
You don't have to, you can do it like this
Your code helped, now the same messages are not shown 100 times but only 4-10 times. Perhaps the else operator needs to be added.
Thank you.
In Expert tick function
void OnTick() - it turns out that the code line : if(CountOrders()==0&ObjectGetInteger (0, "lab_Button",OBJPROP_STATE)) is not only the first order trigger when the EA is initially started
but also each run after the order has been closed according to a condition:
do I understand it correctly?
These are the conditions for running the EA, if( if) (CountOrders()==0( no order )&&ObjectGetInteger(0, "lab_Button",OBJPROP_STATE))( and the button is pressed), then we can trade
How and where is the code written?
The code is inserted in the body of int start() function of the EA. I added else operator, which screws empty variable, duplication of data has stopped, but when two consecutive losing profits, duplication of data occurs 10 and 2-3 times. Commented out my original loop, which gave the same information 100 times. Your working one.
Will print once when there is a loss trade
But the advisor doesn't see that it's Friday and closes positions every day
it looks like this
Hi all, I have inserted a function to close positions on Friday at 8:30pm
But the advisor doesn't see that it's Friday and closes positions every day
stands like this
Please tell me how to output this to an external variable