[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 748
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Try to restart your terminal.
:) Thanks! Restarting the terminal didn't help, but restarting my own brain did! I use different blocks in my EA - trading block, criteria block, variable block, block of additional functions, etc., which are connected by an inclu... So I was changing the block of trading criteria "Criteria", and I needed "Criteria01". That's the trick... :)
ZZZ... I was beginning to believe in the "drubashki"... :) I should have just got some sleep...
PLEASE HELP ME !!! In the following code I check if the order was profitable or not ! If not I count the amount !!!
If the first trade was unprofitable then the counting loop is started and is added forever.
But there is a catch !!! If a deal is profitable, then all subsequent losing orders are counted normally ....
double orderProf; // Counter of the number of losing trades
double CalculateLots(){
double Res=0.01;
bool bProfit=true;
int PrevTime=-1;
double tmpLots;
for (int i=0;i<OrdersHistoryTotal();i++){
if (!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) continue;
if (OrderSymbol()!=Symbol()) continue;
if (OrderCloseTime()<PrevTime) continue;
PrevTime=OrderCloseTime();
if (OrderProfit()>0){bProfit=true; orderProf=0;} if (OrderProfit()<0){bProfit=false; orderProf++;}
tmpLots=OrderLots();
}
return(Res);
}
I gave you a link to Igor Kim... There are a lot of things you need for your needs...
DAK ! It's the same as mine ....
The PROBLEM is that the first time it doesn't count normally, but after that it counts normally.... )))
help ...
The conundrum is this.
The indicator at the very end of the code creates an object, which serves as a flag for another indicator.
After creating the object, I need to "sleep" the indicator for 5 seconds, then delete the object and sleep it for 60 seconds, after which it will go to the last retry and start over from the beginning with a new tick.
Trying to do this
It hangs until it seems to run out of time.
Any tips on how to do this?
The conundrum is this.
The indicator at the very end of the code creates an object, which serves as a flag for another indicator.
After creating the object, I need to "sleep" the indicator for 5 seconds, then delete the object and sleep it for 60 seconds, after which it will go to the last retry and start over from the beginning with a new tick.
Trying to do this
It hangs until it seems to run out of time.
Any tips on how to do this?
Sledgehammer... :):)
As a timer? It will go into a lethargic sleep :)
Okay, that's off-topic. I wish I could be more specific. One to wake him up, one to put him down, one to nail him...
What about feeding? :)
more details on
Make a pause in the indicator. Sort of like sleep.
What's wrong with Sleep?
And also - when checking the presence of an object
you compare with the subwindow number of the indicator. What if there are two of them?It is better to compare with a variable which is assigned to the subwindow number of the desired indicator.
This is how I search:
And then I already check the presence of the subwindow:
What do you dislike about Sleep?
What if I have two of them?
It won't. Just getting rid of unnecessary windows.
I'll need a check later, though, but hopefully for the EA :) thanks, I'll make a note of it.