Open project - tester-optimiser in-house - page 3

 
I have posted the source code here - http://forexsystems.ru/phpBB/viewtopic.php?p=4379#4379
You can see the comments, which had to be removed.
The purpose of TradeOrdersArray and ClosedOrdersArray arrays is described there. And some more.
 
Overridden OrderSend trading function.
Functions CorrectPrice() and DrawArrowOnChart() have not yet been defined.
I posted it here - http://forexsystems.ru/phpBB/viewtopic.php?p=4380#4380

Had to drag all variables from init() block to header - otherwise variables are not visible. My first error.
The second one is that the compiler is swearing at my attempt to set the default value of a parameter in the function to NULL.
Third, the compiler doesn't crash when an undefined/undefined function (CorrectPrice() and DrawArrowOnChart() ) is encountered in the code.
Perhaps it will stumble upon NULL and won't complain further.
The function definition is stupid - I copied from dictionary, so if developers will blame me for wrong declaration ....

  //+------------------------------------------------------------------+
//| Redefine OrderSend() function                       |
//+------------------------------------------------------------------+


int fut_OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit,
 string comment=[b]NULL[/b],int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)
  {
  if (CorrectPrice(symbol,cmd,price,myCurrentTime))
      {
      TradeOrdersArray[myOrdersTotal,0]= symbol;
      TradeOrdersArray[myOrdersTotal,1]=pool_pos;
      TradeOrdersArray[myOrdersTotal,2]=myOrderTicket+1;
      TradeOrdersArray[myOrdersTotal,3]=cmd;
      TradeOrdersArray[myOrdersTotal,4]=volume;
      TradeOrdersArray[myOrdersTotal,5]=price;
      TradeOrdersArray[myOrdersTotal,6]=slippage;
      TradeOrdersArray[myOrdersTotal,7]=stoploss;
      TradeOrdersArray[myOrdersTotal,8]=stoploss;
      TradeOrdersArray[myOrdersTotal,9]=comment;
      TradeOrdersArray[myOrdersTotal,10]=magic;
      TradeOrdersArray[myOrdersTotal,11]=myCurrentTime;
      DrawArrowOnChart(symbol,myCurrentTime,price,arrow_color);
      myOrderTicket++;
      myOrdersTotal++;
      pool_pos++;
      return(myOrderTicket);
      }
      else return(-1);
  }



Tomorrow I'll try to redefine OrderClose() - it will be easier to explain the testing idea there.
PS Two people have already downloaded it - there is hope

 
You can see the comments that had to be deleted

Rosh, I figured out how to insert Russian text in this forum (I had to figure it out myself :)
When you copy the code in the editor, you should put it in Russian. And when you paste it into a forum, respectively, as well.
And all the comments will be saved ;)
 
Renat, Slava...
Here's a good example to the discussion about the empty operator.
Implicit type conversion is much worse and more dangerous than ";" after a parenthesis.
In this case we have an explicit error, but the compiler won't even generate a warning.

Rosh,
the page went away again.
 
One more try:

int fut_OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, 
double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)
  {
  if (CorrectPrice(symbol,cmd,price,myCurrentTime))
      {
      TradeOrdersArray[myOrdersTotal,0]= symbol;// записали иструмент
      TradeOrdersArray[myOrdersTotal,1]=pool_pos;// записали номер в списке терминала
      TradeOrdersArray[myOrdersTotal,2]=myOrderTicket+1;// записали номер тикета у брокера
      TradeOrdersArray[myOrdersTotal,3]=cmd;// записали тип ордера
      TradeOrdersArray[myOrdersTotal,4]=volume;// записали размер ордера
      TradeOrdersArray[myOrdersTotal,5]=price;// записали цену открытия
      TradeOrdersArray[myOrdersTotal,6]=slippage;// записали проскальзывание в пунктах
      TradeOrdersArray[myOrdersTotal,7]=stoploss;// записали stoploss
      TradeOrdersArray[myOrdersTotal,8]=stoploss;// записали takeprofit
      TradeOrdersArray[myOrdersTotal,9]=comment;// записали комментарии
      TradeOrdersArray[myOrdersTotal,10]=magic;// записали MagicNumber
      TradeOrdersArray[myOrdersTotal,11]=myCurrentTime;// записали дату выставления/открытия ордера
      DrawArrowOnChart(symbol,myCurrentTime,price,arrow_color);
      myOrderTicket++;
      myOrdersTotal++;
      pool_pos++;
      return(myOrderTicket);
      }
      else return(-1);
  }
//+------------------------------------------------------------------+
 
There is a serious mistake in the text.
 
Thank you, Mak. Brevity is the sister of talent.
 
Rosh,
I just wanted Renat to look at it himself and find the error.
But it seems they don't look here or think my post is stupid.
(quote - "we don't answer silly questions ..." - :))

This is on the topic of disadvantages of MQL syntax (and/or compiler).
The compiler will not respond to this error, even though it could warn you about it.
I would simply prohibit such errors in a language (implicit type conversion).

To be specific.
The TradeOrdersArray array has type double.
In several places, you've assigned string values to it.
For example:
TradeOrdersArray[myOrdersTotal,0]= symbol;


The compiler will eat it all up, and even the tester will work, but not the way you wanted.
And it's hard to look for such an error, especially if it was made a month ago,
and only showed up today when you added a few lines to the program.

(Plz., fix the script - page is gone, it's not convenient to look.)

 
Then how do I define an array to store data of different types?
Here is this declaration
string comment=NULL
the compiler gets an error.
But I just copied from dictionary by pattern.
 
How do I define an array to store data of different types?

I suspect you can't.
Only in 2 different arrays.