:) 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...
itum: 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 you'll find a lot of goodies for your needs...
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
int pauseT=0, //
pause01=0, // время первой паузы
pause02=0; // время второй паузыif (ObjectFind("signalG")==1) // проверка наличия
pause01=TimeLocal()+5; //
{while (TimeLocal()<pause01) // цикл сравнения
{pauseT=TimeLocal()+1;} // чем бы его занять?????ObjectDelete("signalG");}
if (ObjectFind("signalG")==-1) // повтор всего для 2-ой паузы
pause02=TimeLocal()+15;
while (TimeLocal()<pause02)
{pauseT=TimeLocal()+1;}
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.
Abzasc: As a timer? It will go into a lethargic sleep :)
Well... when he needs to be tickled, he'll wake up... :) 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? :)
And also - when checking the presence of an object
if (ObjectFind("signalG")==1) // проверка наличия
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:
int WinID=WindowFind("A/D"); // Номер окна AD
And then I already check the presence of the subwindow:
// --------------- Начертим восходящую трендовую линию (DN - экстремумы) --------------------- if (WinID>0) // Если окно индикатора есть на чарте (оно может иметь любой номер, кроме 0)
{
if (ObjectFind("Trend_GLine_DN")<0) // Если объект ещё не построенObjectCreate("Trend_GLine_DN",OBJ_TREND,WinID,LowestTDN,LowestPeakDN,HighestTDN,HighestPeakDN);
ObjectSet("Trend_GLine_DN",OBJPROP_COLOR,Lime);
ObjectSet("Trend_GLine_DN",OBJPROP_TIME1,LowestTDN);
ObjectSet("Trend_GLine_DN",OBJPROP_PRICE1,LowestPeakDN);
ObjectSet("Trend_GLine_DN",OBJPROP_TIME2,HighestTDN);
ObjectSet("Trend_GLine_DN",OBJPROP_PRICE2,HighestPeakDN);
}
Doesn't work in the indicators. The reason for doing it this way - I don't understand. Apparently, a constantly working indicator is supposed to hypnotise :)
artmedia70:
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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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.