[АРХИВ]Любой вопрос новичка, чтоб не захламлять форум. Профи, не проходите мимо. Без вас никуда - 5. - страница 427

 
Dimka-novitsek:
Функция при вызове ругается, что Ожидается параметр типа string. Куда ему стринг?

в какой строке ругается? какой вызов функции?
 
Мне кажется, это именно ордерсенд ругается.
 

Мне кажется, это именно ордерсенд ругается.

 

Да, ну конечно. Вот!   2013.06.16 14:32:49 2010.02.01 08:04 Конструктор EURUSD,H1: OrderSend error 4062
 

 
Ну и что? Ну и какой же там стринг??????
 
В общем, особ е понял. Я щас или удалю всю заднюю часть скобок стринга, что б не мешались..
 
Dimka-novitsek:
Доброго дня! Функция при вызове ругается, что Ожидается параметр типа string. Куда ему стринг?    Собственно, я почти эту же функцию годами использовал, и не ругпалась же. Я только ее на две раздилил- на бай и на селл.Пишу робот, почти весь из функций.
У  OrderSend() 8-й параметр строковый, а в коде double.
 
Zhunko:
У  OrderSend() 7-й параметр строковый, а в коде double.


восьмой

int RasstawimSell(int Raz,double Dist_pervaya,double Dist_dalshaya,double TP, double SL,double Lot,string com,int Magicnumber)
{                  

    double Price=0.0,TP_BUY=0.0,SL_BUY=0.0,Price_SELL=0.0,TP_SELL=0.0,SL_SELL=0.0;int Error=0;string errorcomment;
    
    
           Price_SELL= (Bid-Dist_pervaya*Point) ;  TP_SELL=Price_SELL-TP*Point;  SL_SELL=Price_SELL+SL*Point; 
           
   for(int Raz1=0;Raz1<Raz;Raz1++){
   
           Sleep(2000); RefreshRates();  for(int A=25;A>=0;A--){if(IsTradeAllowed())break;if(A==0) 
Comment(" эксперту не разрешено торговать или поток для выполнения торговых операций занят "); }           
                
           OrderSend (Symbol( ), OP_SELLSTOP,  Lot ,NormalizeDouble(Price_SELL, Digits), 5,
 NormalizeDouble( SL_SELL,Digits),   NormalizeDouble( TP_SELL,Digits),"com", Magicnumber,  0, CLR_NONE);

   Price_SELL= (Price_SELL -Dist_dalshaya*Point) ;TP_SELL=Price_SELL-TP*Point;   SL_SELL=Price_SELL+SL*Point;
            Error=GetLastError();if (Error==0)
            
            {errorcomment = "Ошибка открытия ордера селлстоп  "  + " " + Symbol() +  " " + ErrorDescript(Error); 
        Print (errorcomment);return(Error);} 
                       }
                          
                        
   return(Error);
}   
 
Спасибо!!!!!
 
Да!!!
 

ВОПРОС ПРОСТОЙ. ЧЕГО-ТО ЗАБЫЛ С EMPTY  И ОТРЕЗОК ЛИНИИ ИДЕТ "ЛОМАНЫЙ". Прошу подсказать чего не помню))):

 

 

//+------------------------------------------------------------------+
//|                                                        Pivot.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
//#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Aqua
#property indicator_color3 Magenta
#property indicator_color4 DarkBlue
#property indicator_color5 Maroon
#property indicator_color6 Green
#property indicator_color7 Green
//---- input parameters
extern string __ManualPeriod__ = "Period D1 & H1 !!!";
extern string PERIOD     = "D1";
extern bool LINE_ALL     = true;
extern bool LINE_P       = false;
extern bool LINE_S1      = true;
extern bool LINE_R1      = true;
extern bool LINE_S2      = false;
extern bool LINE_R2      = false;
extern bool LINE_S3      = false;
extern bool LINE_R3      = false;
extern color ColorLab    = Red;
//---- buffers
double PPBuffer[];
double S1Buffer[];
double R1Buffer[];
double S2Buffer[];
double R2Buffer[];
double S3Buffer[];
double R3Buffer[];
string Pivot="Pivot Point",Sup1="S 1", Res1="R 1";
string Sup2="S 2", Res2="R 2", Sup3="S 3", Res3="R 3";
int fontsize=10;
double P,S1,R1,S2,R2,S3,R3;
double LastHigh,LastLow,x;
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   ObjectDelete("Pivot");
   ObjectDelete("Sup1");
   ObjectDelete("Res1");
   ObjectDelete("Sup2");
   ObjectDelete("Res2");
   ObjectDelete("Sup3");
   ObjectDelete("Res3");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 
   SetIndexBuffer(0,PPBuffer);
   SetIndexBuffer(1,S1Buffer);
   SetIndexBuffer(2,R1Buffer);
   SetIndexBuffer(3,S2Buffer);
   SetIndexBuffer(4,R2Buffer);
   SetIndexBuffer(5,S3Buffer);
   SetIndexBuffer(6,R3Buffer);
//---- 
   SetIndexStyle(0,DRAW_LINE,1,1);
   SetIndexStyle(1,DRAW_LINE,0,2);
   SetIndexStyle(2,DRAW_LINE,0,2);
   SetIndexStyle(3,DRAW_LINE,0,2);
   SetIndexStyle(4,DRAW_LINE,0,2);
   SetIndexStyle(5,DRAW_LINE,0,2);
   SetIndexStyle(6,DRAW_LINE,0,2);
//----
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);
   SetIndexEmptyValue(3,0.0);
   SetIndexEmptyValue(4,0.0);
   SetIndexEmptyValue(5,0.0);
   SetIndexEmptyValue(6,0.0);
//----
   SetIndexStyle(0,EMPTY);
   SetIndexStyle(1,EMPTY);
   SetIndexStyle(2,EMPTY);
   SetIndexStyle(3,EMPTY);
   SetIndexStyle(4,EMPTY);
   SetIndexStyle(5,EMPTY);
   SetIndexStyle(6,EMPTY);
//---- 
   SetIndexLabel(0,"Pivot Point line");
   SetIndexLabel(1,"Support 1 line");
   SetIndexLabel(2,"Resistance 1 line");
   SetIndexLabel(3,"Support 2 line");
   SetIndexLabel(4,"Resistance 2 line");
   SetIndexLabel(5,"Support 3 line");
   SetIndexLabel(6,"Resistance 3 line");
//----
   IndicatorDigits(Digits);
   SetIndexDrawBegin(0,1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   int limit, i, pr, pr_1;
//---- indicator calculation
   if (counted_bars==0)
     {
      x=Period();
      if (x>240) return(-1);
      if (PERIOD=="D1")
      {
      if (LINE_ALL==true || LINE_P==true)
       {
      ObjectCreate("Pivot", OBJ_TEXT, 0, 0,0);
      ObjectSetText("Pivot", "                 Pivot Point",fontsize,"Arial",ColorLab);
       }
      if (LINE_ALL==true || LINE_S1==true)
       {
      ObjectCreate("Sup1", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Sup1", "      S 1",fontsize,"Arial",ColorLab);
       }
      if (LINE_ALL==true || LINE_R1==true)
       {
      ObjectCreate("Res1", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Res1", "      R 1",fontsize,"Arial",ColorLab);
       }
      if (LINE_ALL==true || LINE_S2==true)
       {
      ObjectCreate("Sup2", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Sup2", "      S 2",fontsize,"Arial",ColorLab);
       }
      if (LINE_ALL==true || LINE_R2==true)
       {
      ObjectCreate("Res2", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Res2", "      R 2",fontsize,"Arial",ColorLab);
       }
      if (LINE_ALL==true || LINE_S3==true)
       {
      ObjectCreate("Sup3", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Sup3", "      S 3",fontsize,"Arial",ColorLab);
       }
      if (LINE_ALL==true || LINE_R3==true)
       {
      ObjectCreate("Res3", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Res3", "      R 3",fontsize,"Arial",ColorLab);
       }
      }
     }
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   //   if(counted_bars>0) counted_bars--;
   limit=(Bars-counted_bars)-1;
//----
   for(i=limit; i>=0;i--)
     {
      if (High[i+1]>LastHigh) LastHigh=High[i+1];
      if (Low[i+1]<LastLow) LastLow=Low[i+1];
      if (PERIOD=="D1") 
      {
      pr = TimeDay(Time[i]); 
      pr_1 = TimeDay(Time[i+1]);
      } 
      else
      if (PERIOD=="H1") 
      {
      pr = TimeHour(Time[i]); 
      pr_1 = TimeHour(Time[i+1]);
      }
      else 
      {
      pr = TimeDay(Time[i]); 
      pr_1 = TimeDay(Time[i+1]);
      }
      if (pr!=pr_1)
        {
         P=(LastHigh+LastLow+Close[i+1])/3;
         R1=(2*P)-LastLow;
         S1=(2*P)-LastHigh;
         R2=P+(LastHigh - LastLow);
         S2=P-(LastHigh - LastLow);
         R3=(2*P)+(LastHigh-(2*LastLow));
         S3=(2*P)-((2* LastHigh)-LastLow);
         LastLow=Open[i]; LastHigh=Open[i];
//----
         ObjectMove("Pivot", 0, Time[i],P);
         ObjectMove("Sup1", 0, Time[i],S1);
         ObjectMove("Res1", 0, Time[i],R1);
         ObjectMove("Sup2", 0, Time[i],S2);
         ObjectMove("Res2", 0, Time[i],R2);
         ObjectMove("Sup3", 0, Time[i],S3);
         ObjectMove("Res3", 0, Time[i],R3);
        
         PPBuffer[i+1] = EMPTY;
         S1Buffer[i+1] = EMPTY;
         R1Buffer[i+1] = EMPTY;
         S2Buffer[i+1] = EMPTY;
         R2Buffer[i+1] = EMPTY;
         S3Buffer[i+1] = EMPTY;
         R3Buffer[i+1] = EMPTY;
        }
      if (PERIOD=="H1" || PERIOD=="D1")
      {
      if (LINE_P==true)       PPBuffer[i]=P;      
      if (LINE_S1==true)      S1Buffer[i]=S1;
      if (LINE_R1==true)      R1Buffer[i]=R1;
      if (LINE_S2==true)      S2Buffer[i]=S2;
      if (LINE_R2==true)      R2Buffer[i]=R2;
      if (LINE_S3==true)      S3Buffer[i]=S3;
      if (LINE_R3==true)      R3Buffer[i]=R3;
      }
//----
      if (PERIOD=="D1" && LINE_ALL==true)
      {
      PPBuffer[i]=P;
      S1Buffer[i]=S1;
      R1Buffer[i]=R1;
      S2Buffer[i]=S2;
      R2Buffer[i]=R2;
      S3Buffer[i]=S3;
      R3Buffer[i]=R3;
      }
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
Причина обращения: