[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

 
Roger:
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...

 
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...
 
artmedia70:
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

      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;}

It hangs until it seems to run out of time.

Any tips on how to do this?

 
Abzasc:

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... :):) Sorry, couldn't resist... :)
 
artmedia70:
Sledgehammer... :):)
As a timer? He'll go into a lethargic sleep :)
 
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? :)
 
artmedia70:
more details on
Make the indicatorpause. Sort of like a sleep.
 
Abzasc:
Make a pause in the indicator. Sort of like sleep.

What's wrong with Sleep?

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);
                  }
 
artmedia70:

What do you dislike about Sleep?

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.