[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 19

 
Ereke:
Congratulations to YOU !

Congratulations are in order. Although a shot in the air doesn't hurt anyone.
 
Vinin:

Congratulations are in order. Although a shot in the air doesn't hurt anyone.
Victor, is your Skype down or is your connection dying? What's up with the ZZ?
 
2011.01.24 17:18:44 TestGenerator: unmatched data error (volume limit 971 at 2011.01.19 10:00 exceeded)
Could you tell me what kind of error it is? In the log during the test in bulk, but the orders open.
 
artmedia70:
Victor, is your Skype down or is your connection dying? What's the ZZ?

Yeah, I'm saying maybe I should make a special zapper. It's not my Skype that's dying. I got you in green.
 
r.ig.h:
2011.01.24 17:18:44 TestGenerator: unmatched data error (volume limit 971 at 2011.01.19 10:00 exceeded)
Could you tell me what kind of error it is? In the log during the test in bulk, but the orders open.

There is no history or there are errors in the history
 
Help script tweak that would mean open a deal immediately, at the current market price. A chet, I'm already steamed up Distance from the fish in 5 pips is not satisfied, and so that would be at least with a deflection in the swap.
Files:
 

Good evening !

I can't seem to make sense of the

shift - Index of the value received from the indicator buffer (shift relative to the current bar by the specified number of periods back).

In the Fractals indicator. If I think correctly - the indicator shows the extremum value among five bars with the condition that maxima of two previous and two following bars (in case of a fractal upwards) are smaller (though the "birdie" of a fractal is shown on the chart also when the extremum of the leftmost bar of those five = extremum ......, not smaller than it). So why shift then ? What will be shown if shift is not equal to 3 but equal to 2 or 5 ?

 

I made this code to enter the market after the first fractal break after MA break. But when tested, it does not open trades everywhere, although it seems to be supposed to do so. I cannot understand what is wrong? In real mode (when checking on M1 I cannot find the error).

 extern int Period_MA = 5,                 // Период расчётной МА
            PERIOD=1,                      // Период текущего графика (таймфрейм)
            MODE=3,                        // Метод усреднения из методов скользящего среднего
            PRICE_TYPE=0,                  // Используемая цена из ценовых констант
            Прибыль=10,
            Ограничение=55;

 double 
        upfractal,
        dwfractal,
        SL[10001]={0,,10000},
        TP[10001]={0,,10000};
        
 bool   Двверх=false,
        Дввниз=false,
        Сделкавверх=false,
        Сделкавниз=false;
        
  int   A,                             // Переменная массива вверх
        B,                             // Переменная массива вниз
        BarTime,                       // Время текущего бара
        ticketup,                      // Ордер вверх
        ticketdown,                    // Ордер вниз
        Tвверх,                        // Время сделки вверх
        Tвниз;                         // Время сделки вниз;
        
 color вверх = SpringGreen,           // Цвет сделки вверх
       вниз = Red;                    // Цвет сделки вниз       
        
int start()
  {
  
  string Symb=Symbol();         // Финанс. инструмент
  
  double  Lot=0.01;              // Лот
  
    if(BarTime!=Time[0])           // Условие для того, чтобы программа считала только на начале бара, а не на каждом тике
      {
        double MA_1 = iMA(Symbol(),PERIOD,Period_MA,0,MODE, PRICE_TYPE, 1);
        double MA_2 = iMA(Symbol(),PERIOD,Period_MA,0,MODE, PRICE_TYPE, 2);
        double MA_3 = iMA(Symbol(),PERIOD,Period_MA,0,MODE, PRICE_TYPE, 3);
        double MA_4 = iMA(Symbol(),PERIOD,Period_MA,0,MODE, PRICE_TYPE, 4);
        double MA_5 = iMA(Symbol(),PERIOD,Period_MA,0,MODE, PRICE_TYPE, 5);
        double MA_6 = iMA(Symbol(),PERIOD,Period_MA,0,MODE, PRICE_TYPE, 6);
        double MA_7 = iMA(Symbol(),PERIOD,Period_MA,0,MODE, PRICE_TYPE, 7); 
        double MA_8 = iMA(Symbol(),PERIOD,Period_MA,0,MODE, PRICE_TYPE, 8); 
               
//--------------------------------------------------------------------
        if(NormalizeDouble(MA_8,Digits)>NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_7,Digits)>=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_6,Digits)>=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_5,Digits)>=NormalizeDouble(MA_2,Digits) 
        && NormalizeDouble(MA_3,Digits)>=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_4,Digits)>=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_2,Digits)<NormalizeDouble(MA_1,Digits)) // Перелом вверх
          {
            Двверх=true;
            Alert("Двверх");
            Дввниз=false;
            Сделкавниз=false;
            dwfractal=0;
            upfractal=0;
          }
        if(Двверх==true)
          {    
            
                upfractal=iFractals(Symbol(), PERIOD, MODE_UPPER, 3);
                Alert("upfractal вначале = ",upfractal);
                
              
          }
        if(NormalizeDouble(MA_8,Digits)<NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_7,Digits)<=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_6,Digits)<=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_5,Digits)<=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_3,Digits)<=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_4,Digits)<=NormalizeDouble(MA_2,Digits)
        && NormalizeDouble(MA_2,Digits)>NormalizeDouble(MA_1,Digits)) // Перелом вниз
          {
            Дввниз=true;
            Двверх=false;
            Alert("Дввниз");
            Сделкавверх=false;
            upfractal=0;
            dwfractal=0;
          }
        if(Дввниз==true)
          {    
            
                dwfractal=iFractals(Symbol(),PERIOD, MODE_LOWER, 3);
                Alert("dwfractal вначале = ",dwfractal);
              
          }    
          BarTime=Time[0];
      }else                                                                  // На каждый тик
        { 
          Alert("upfractal на тиках = ",upfractal,", Bid = ", Bid);
          if (Двверх==true && upfractal !=0 && Bid > NormalizeDouble(upfractal+1*Point,Digits) && Tвверх!=Time[0] && Сделкавверх==false) // Открытие ордеров при пробитии последнего (свежайшего) фрактала }
            {
               Alert("upfractal = ",upfractal, ", Ask = ",Ask);
               Tвверх=Time[0];
               while(true)                                                  // Цикл открытия орд.
                  {
                    A++;
                    SL[A]=Bid-Ограничение*Point;
                    TP[A]=Bid+7*Point+Прибыль*Point;
                    ticketup=OrderSend(Symb, OP_BUY, Lot, Ask,0, SL[A], TP[A],NULL,A,0,вверх); // Ордер вверх
                        int Error=GetLastError();
                        switch(Error)                                      // Преодолимые ошибки
                          {
                           case 6: Alert("Нет связи с торговым сервером. Пробуем ещё раз..");
                           RefreshRates();                                 // Обновим данные
                           Sleep(1);                                       // Задержка в цикле до нового тика
                         continue;                                         // На след. итерацию
                          }
                         break;                                            // Выход из цикла
                   }
                    Сделкавверх=true; 
            }
            Alert("dwfractal на тиках = ",dwfractal,", Bid = ", Bid);
          if (Дввниз==true && dwfractal !=0 && Bid < NormalizeDouble(dwfractal-1*Point,Digits) && Tвниз!=Time[0] && Сделкавниз==false) // Открытие ордеров при пробитии последнего (свежайшего) фрактала }
            {
               Alert("dwfractal = ",dwfractal, ", Bid = ",Bid);
               Tвниз=Time[0];
               while(true)                                  // Цикл открытия орд.
                  {
                    B++;
                    SL[B]=Bid+Ограничение*Point;
                    TP[B]=Bid-4*Point-Прибыль*Point;
                    ticketdown=OrderSend(Symb, OP_SELL, Lot, Bid,0, SL[B], TP[B],NULL,B,0,вниз); // Ордер вниз
                        Error=GetLastError();
                        switch(Error)                             // Преодолимые ошибки
                          {
                           case 6: Alert("Нет связи с торговым сервером. Пробуем ещё раз..");
                           RefreshRates();                        // Обновим данные
                           Sleep(1);                              // Задержка в цикле до нового тика
                         continue;                                // На след. итерацию
                          }
                         break;                                    // Выход из цикла
                   }
                   Сделкавниз=true;
            } 
        }
//----
   return(0);
  }
//+------------------------------------------------------------------+
And until it works out in the tester, there's no sense in using it for optimization with an error. What's the error... ?
 

Adapted from a separate thread

Leonid82 24.01.2011 19:51

Hi, I have an Expert Advisor which works with EURUSD. How can I get High[1] on GBPUSD for example?

Thank you for your help.

 

Leonid82, High[1] is the high price on the first candle. To get it, you just need to make this script. And this price is obtained not from the Expert Advisor, but from the terminal.

//+------------------------------------------------------------------+
//|                 Старт работы скрипта                             |
//+------------------------------------------------------------------+
int start(){
  Alert("High[",i,"] = ",High[i]);
        return(0);
}