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

 
Frostr:

I put your data into the Expert Advisor and ran it )

Was that not the right way to do it?


I don't understand what kind of data? I just gave you the EA code. compile it and run it, just give it a name. I haven't tested it, I just recompiled it as it turned out and put it out. If it doesn't work correctly, let me know and I'll try to figure out why.
 
Frostr:
file://localhost/C:/Users/mv/Desktop/StrategyTester.htm
Nice link. Just a looker :)
 
rigonich:

I don't understand what kind of data? I just put the code of the EA. compile and run it, just give it a name. I have not tested it, I just recompiled it as it turned out and put it out. If it doesn't work correctly, let me know and I'll try to figure out why.



Hooray I got it ... searched on the web for compile ))) it turns out Compile .

I have already started testing it, it opens 500-1000 positions at once

Here's a link to the test file://localhost/C:/Users/mv/Desktop/StrategyTester.htm - it opens too many positions

 
Frostr:



Hooray I got it ... searched on the web for what it means to Compile))) it turns out Compile .

I've already started testing it with Compile, it opens 500-1000 positions at once


Well, let's see.
 

Can you please tell me how many characters are currently untouchable in the order comments?

Z.I. If it is important, it is on Alpari.

 
Frostr:



hooray I figured it out... I searched on the web for "Compile")) it turns out Compile .

I have already started testing it, it opens 500-1000 positions at once

Here's a link to the test: file://localhost/C:/Users/mv/Desktop/StrategyTester.htm it opens a lot of positions


Here is the code. It works as you asked. At any close it opens two opposite positions.
//+------------------------------------------------------------------+
//|                                                  Trudnyaga_1.mq4 |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
//+------------------------------------------------------------------+
extern int    stoploss   = 0,          // уровень выставления SL, если 0, то SL не выставляется
              takeprofit = 0,          // уровень выставления TP, если 0, то TP не выставляется
              Magic      = 123456;     // уникальный номер ордера
extern double Lot        = 0.1;        // объем ордера
extern int    slippage   = 3;          // Максимально допустимое отклонение цены для рыночных ордеров
extern int    MaxOrders  = 3;          // Максимально допустимое количество ордеров BUY или SELL
extern int    CycleCount = 5;          // количество попыток открытия ордера
//+------------------------------------------------------------------+
double SL,TP;
int    Total,LastTotal;
string ord;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
   {
   return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
   {
   return(0);
}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
   {
   Total=fTotal();
   if((Total==LastTotal&&LastTotal!=0)||Total>=MaxOrders)return(0);
   if(takeprofit!=0)TP=NormalizeDouble(Ask+takeprofit*Point,Digits);else TP=0;
   if(stoploss!=0)SL=NormalizeDouble(Ask-stoploss*Point,Digits);else SL=0;
   OPENORDER("Buy");
   if(takeprofit!=0)TP=NormalizeDouble(Bid-takeprofit*Point,Digits);else TP=0;
   if(stoploss!=0)SL=NormalizeDouble(Bid+stoploss*Point,Digits);else SL=0;
   OPENORDER("Sell");
   LastTotal=fTotal();
   return(0);
}
//+------------------------------------------------------------------+
void OPENORDER(string ord)
   {
   int error,err;
   while(true)
      { 
      error=-1;
      if(ord=="Buy" )error=OrderSend(Symbol(),OP_BUY, Lot,NormalizeDouble(Ask,Digits),slippage,SL,TP,"BUY",Magic,0,Blue);
      if(ord=="Sell")error=OrderSend(Symbol(),OP_SELL,Lot,NormalizeDouble(Bid,Digits),slippage,SL,TP,"SELL",Magic,0,Red);
      if(error==-1) //неудачная покупка OK
         { 
         ShowERROR();err++;Sleep(2000);RefreshRates();
      }
      if (err>=CycleCount)break;
   }
   return;
} 
//+------------------------------------------------------------------+
void ShowERROR()
   {
   int err=GetLastError();
   switch(err)
      { 
      case 1   : return;
      case 2   : Alert("Нет связи с торговым сервером ",Symbol());return;
      case 3   : Alert("Error неправильные параметры ",Symbol());return;
      case 130 : Alert("Error близкие стопы Ticket ",Symbol());return;
      case 134 : Alert("Недостаточно денег ",Symbol());return;
      case 146 : Alert("Error Подсистема торговли занята ",Symbol());return;
      case 129 : Alert("Error Неправильная цена ",Symbol());return;
      case 131 : Alert("Error Неправильный объем ",Symbol());return;
      case 4200: Alert("Error Объект уже существует ",Symbol());return;
      default  : Alert("Error " ,err," ",Symbol());return;
   }
}
//+------------------------------------------------------------------+
int fTotal()
   {
   int Tot=OrdersTotal();
   int BuyCount=0,SellCount=0;
   if(Tot>0)
      {
      for(int i=0;i<OrdersTotal();i++)
         {
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
            {
            if(OrderSymbol()==Symbol()&&(Magic==0||OrderMagicNumber()==Magic))
               {
               switch (OrderType())
                  {
                  case OP_BUY :BuyCount++; break;
                  case OP_SELL:SellCount++;break;
               }
            }
         }
      }
   }
   return(BuyCount+SellCount);
}
//+------------------------------------------------------------------+
 
which post office can text about incoming mail and its contents?
 
gheka:
which post office can text about incoming mail and its contents?
You'd better buy a smartphone, they're cheaper now. Just don't connect to MTS, those bastards stole my last two kopecks :))
 
No offence, I'll stand by MTS. 7 years with MTS and no problems
 
gheka:
No offence, I'll stand by MTS. 7 years with MTS and no problems

As long as I only had a phone, I didn't have any problems for five years either. As soon as I connected their Internet, problems (with payment) appeared at once. Of course they solve them, and even apologize, but it is too much to write and prove. Most importantly, after a month the same problem again and everything is all over again. So now I use megaphone.
Reason: