[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 378

 
Dimka-novitsek:
I wanted to display the data in the visualization test during testing. I start a test of one Expert Advisor. I drag another EA on the same chart as it is being tested. I do not see any comment! The Expert Advisor is smiling...


It will not work like this. An EA dragged on a visual testing chart will either show nothing at all or it will show what is in the account, not in the tester (I don't know exactly, I somehow lacked creativity to create such a thing:)

 

You know, I don't see a comment on the chart.

int start()
  { Comment("OrdersProfit  ",OrderProfit(),"AccountBalance  ",AccountBalance(),"Equity  ",AccountEquity());
//----
  double Itogo_Profit=Orderasthitaem();
  if (Itogo_Profit>ProfitSeriyniy){Pozuminusudalaem();}
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
Integer:

Vadim, have you tried applying it? It doesn't sync anything. I've been playing with it recently. You have to build the queue yourself. Unfortunately, all it does is reduce the code by three lines. Or maybe I don't understand it.
Haven't tried it. I'll try it now. I'm doing everything in DLL now. It's easier there.
 
Thank you, Integer!!!
 

I see. VVel in init()
{
//----
Comment("OrdersProfit ",OrderProfit(), "AccountBalance ",AccountBalance(), "Equity ",AccountEquity());
//----
return(0);
}

There's nothing in the tester. Well...

 

Dimka-novitsek:


I see. VVel in init()
{
//----
Comment("OrdersProfit ",OrderProfit(), "AccountBalance ",AccountBalance(), "Equity ",AccountEquity());
//----
return(0);
}

There's nothing in the tester. Well...


Perhaps, the Expert Advisor in which it has been pasted, has the function of comment output? Check how many times the Comment() function is called in this EA.

To output OrderProfit(), the order should be selected first.

Also...what is the point of doing it in the init? It should be done in start().

 
Integer:


Maybe the EA in which this is inserted still has a Comment() function? Check how often the Comment() function is called in the EA.

To output OrderProfit(), the order has to be selected first.

Also...what is the point of doing it in the init? It should be done in start().



In Inite, I wanted to see if my stuff writes anything, but there are no ticks. And I duplicated this line in the init. And I messed up with OrderProfit()!

Here we have a whole puzzle. Can you believe it!!! 4063 is expected to be an integer parameter.

here -

OrderClose(  Orderasthitaem[i,0,1], Orderasthitaem[i,0,2], Bid, 5, 0) ; Error=GetLastError(); 

Array of doublet type. Ticket is exactly an integer and ticket, but it turns out to be a double. How from the function doublet get integer number?

Excuse me, I do not understand at all.

 
Integer:

Vadim, have you tried to apply it? It does not synchronize in any way. I've been playing with it recently. You have to arrange the queue yourself. Unfortunately, it only allows you to shorten the code by three lines. Or maybe I don't understand it.

The queue is organised as in any other language. By itself through the organisation of the input and output of the block to be protected.

This is a script:

#property show_inputs

extern int Pause = 1000;

int    hwndChart = NULL; // Уникальный идентификатор скрипта.
string sName = "Condition";

void init()
 {
  hwndChart = WindowHandle(Symbol(), 0);
  // Создаём глобальную переменную синхронизации скриптов.
  if (!GlobalVariableCheck(sName)) GlobalVariableSet(sName, 0);
 }
 
void deinit()
 {
  GlobalVariableDel(sName);
 }

void start()
 {
  while (!IsStopped())
   {// Начало блока синхронизации.
    GlobalVariableSetOnCondition(sName, hwndChart, 0);
    if (GlobalVariableGet(sName) == hwndChart)
     {
      Print("Start");
      Sleep(Pause); // Имитация работы.
      Print("End");
     }
    GlobalVariableSetOnCondition(sName, 0, hwndChart);
    // Завершение блока синхронизации.
    Sleep(200);
   }
 }
As for cutting, like replacing with other functions, it won't work. This is what atomic access is for. Only one function can do this in MQL4.
Integer:
I.e. just using this function allows to ensure only one EA works at a time, but the queue is not lined up, one EA can stand idle, and another one can be called twice.

It seems to work fine. Loaded 6 scripts with pauses of 3000, 2000, 1000, 500, 300, 200. Here's part of the log:

19:58:36 Check_GlobalVariableSetOnCondition() GBPJPY,M1: GBPJPY Start
19:58:37 Check_GlobalVariableSetOnCondition() GBPJPY,M1: GBPJPY End
19:58:37 Check_GlobalVariableSetOnCondition() EURUSD,M1: EURUSD Start
19:58:39 Check_GlobalVariableSetOnCondition() EURUSD,M1: EURUSD End
19:58:39 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD Start
19:58:39 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD End
19:58:39 Check_GlobalVariableSetOnCondition() AUDUSD,M1: AUDUSD Start
19:58:43 Check_GlobalVariableSetOnCondition() AUDUSD,M1: AUDUSD End
19:58:43 Check_GlobalVariableSetOnCondition() GBPUSD,M1: GBPUSD Start
19:58:43 Check_GlobalVariableSetOnCondition() GBPUSD,M1: GBPUSD End
19:58:43 Check_GlobalVariableSetOnCondition() EURUSD,M1: EURUSD Start
19:58:45 Check_GlobalVariableSetOnCondition() EURUSD,M1: EURUSD End
19:58:45 Check_GlobalVariableSetOnCondition() GBPUSD,M1: GBPUSD Start
19:58:46 Check_GlobalVariableSetOnCondition() GBPUSD,M1: GBPUSD End
19:58:46 Check_GlobalVariableSetOnCondition() NZDUSD,M1: NZDUSD Start
19:58:46 Check_GlobalVariableSetOnCondition() NZDUSD,M1: NZDUSD End
19:58:46 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD Start
19:58:46 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD End
19:58:46 Check_GlobalVariableSetOnCondition() NZDUSD,M1: NZDUSD Start
19:58:47 Check_GlobalVariableSetOnCondition() NZDUSD,M1: NZDUSD End
19:58:47 Check_GlobalVariableSetOnCondition() GBPJPY,M1: GBPJPY Start
19:58:48 Check_GlobalVariableSetOnCondition() GBPJPY,M1: GBPJPY End
19:58:48 Check_GlobalVariableSetOnCondition() EURUSD,M1: EURUSD Start
19:58:50 Check_GlobalVariableSetOnCondition() EURUSD,M1: EURUSD End
19:58:50 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD Start
19:58:50 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD End
19:58:50 Check_GlobalVariableSetOnCondition() AUDUSD,M1: AUDUSD Start
19:58:54 Check_GlobalVariableSetOnCondition() AUDUSD,M1: AUDUSD End
19:58:54 Check_GlobalVariableSetOnCondition() NZDUSD,M1: NZDUSD Start
19:58:54 Check_GlobalVariableSetOnCondition() NZDUSD,M1: NZDUSD End
19:58:54 Check_GlobalVariableSetOnCondition() EURUSD,M1: EURUSD Start
19:58:56 Check_GlobalVariableSetOnCondition() EURUSD,M1: EURUSD End
19:58:56 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD Start
19:58:57 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD End
19:58:57 Check_GlobalVariableSetOnCondition() AUDUSD,M1: AUDUSD Start
19:59:00 Check_GlobalVariableSetOnCondition() AUDUSD,M1: AUDUSD End
19:59:00 Check_GlobalVariableSetOnCondition() GBPUSD,M1: GBPUSD Start
19:59:00 Check_GlobalVariableSetOnCondition() GBPUSD,M1: GBPUSD End
19:59:00 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD Start
19:59:01 Check_GlobalVariableSetOnCondition() USDCAD,M1: USDCAD End

 
It works, in the sense that one function is executed at one point in time, but the order is not respected.
 
Dimka-novitsek:


...How do you get an integer number from a doublet function?

int Int(double v){

return(v);

}
Reason: