← К каталогу
Исходный код · ID 2880

CurrencyStrengthBoard_v1.8 600+

currencystrengthboard_v1.8 600+.mq4
Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

CurrencyStrengthBoard_v1.8 600+ — это индикатор для MetaTrader 4, отображающий панель относительной силы валют на графике. Он анализирует изменение ценовых данных по парам из заданного списка валют и рассчитывает силу каждой валюты, отображая результаты в виде цветных блоков и текстовых меток на графике.

Индикатор поддерживает два режима отображения: стандартный с отдельными блоками для каждой пары и компактный, показывающий итоговую силу каждой валюты. Значения можно отображать в пипсах или процентах. Панель полностью настраивается по цветам, шрифту и расположению на графике.

Встроена система уведомлений с несколькими уровнями срабатывания. Индикатор может отправлять всплывающие и push-уведомления при достичении валютой или парой заданных порогов силы, а также оповещать о самой сильной и слабой валюте на рынке.

Настройки программы

НастройкаОписание
timeFrame Таймфрейм — Таймфрейм, на котором рассчитывается сила валют
symbolPrefix Префикс символа — Префикс для символов в списке наблюдения
symbolSuffix Суффикс символа — Суффикс для символов в списке наблюдения
outputForSymbol Символ для отображения — Символ пары, данные о которой выводятся в отдельный буфер
compactModeOn Компактный режим — Включает компактный режим отображения силы валют
showInPips Отображать в пипсах — Показывает значения в пипсах вместо процентов
offset_X Горизонтальное смещение — Горизонтальная позиция панели на графике
offset_Y Вертикальное смещение — Вертикальная позиция панели на графике
strongColor Цвет сильной валюты — Цвет блоков для сильных значений
weakColor Цвет слабой валюты — Цвет блоков для слабых значений
neutralColor Цвет нейтральной валюты — Цвет блоков для нейтральных значений
borderColor Цвет рамки — Цвет рамки блоков панели
fontSize Размер шрифта — Размер шрифта текста на панели
Levels alert mode (levelsAlertMode) Режим уведомлений по уровням — Определяет, по каким уровням срабатывают уведомления
Extreme strong level(0-Off) (extremeStrongLevel) Уровень экстремальной силы — Порог для экстремальной силы валюты (0 — выключено)
Very strong level(0-Off) (veryStrongLevel) Уровень очень сильной валюты — Порог для очень сильной валюты (0 — выключено)
Strong level(0-Off) (strongLevel) Уровень сильной валюты — Порог для сильной валюты (0 — выключено)
Currency strength alert On/Off (currencyAlertOn) Уведомления о валюте — Включает оповещения о самой сильной и слабой валюте
Push Notification On/Off (pushNotificationOn) Push-уведомления — Включает отправку push-уведомлений
Получить полный код

Поиск по коду файла

???//+------------------------------------------------------------------+

#property strict    
#property indicator_chart_window

#property indicator_plots   0

enum ENUM_ALERTS
{
   off       = 0,      //Alerts Off
   all       = 1,      //Alerts on all levels  
   extreme   = 2,      //Extreme strong level
   very      = 3,      //Very strong level
   strong    = 4,      //Strong level 
};

input ENUM_TIMEFRAMES   timeFrame            =   PERIOD_D1;
input string            currencyArray        = "USD;EUR;GBP;JPY;AUD;CAD;CHF;NZD";
input string            symbolPrefix         =          "";
input string            symbolSuffix         =          "";
input string            outputForSymbol      =    "EURUSD"; 
input bool              compactModeOn        =        true; 
input bool              showInPips           =        true; 
input int               offset_X             =         200;
input int               offset_Y             =         250;
input color             strongColor          =     clrBlue;   
input color             weakColor            =      clrRed;
input color             neutralColor         =    clrWhite;
input color             borderColor          =    clrWhite;
input int               fontSize             =           8;
input ENUM_ALERTS       levelsAlertMode      =           0;    //Levels alert mode
input double            extremeStrongLevel   =          90;    //Extreme strong level(0-Off)   
input double            veryStrongLevel      =          70;    //Very strong level(0-Off)   
input double            strongLevel          =          50;    //Strong level(0-Off)   
input bool              currencyAlertOn      =       false;    //Currency strength alert On/Off 
input bool              pushNotificationOn   =       false;    //Push Notification On/Off

double outchange[];
double outratio[];

string         watchList[], currencies[], pairs[], IndicatorName, TF, outsymbol;
int            symbolsTotal, num, timeframe, corner = 0, offset_x, offset_y, refresh = 5;

int            strongR, strongG, strongB;
int            weakR,   weakG,   weakB;
int            neutralR,neutralG,neutralB;
double         scale, pairPoint[];
bool           firstTime = true, once = true;

MqlRates       mtfBar[];

int OnInit()
{
      // код доступен только после оплаты
   }

void OnDeinit(const int reason)
{

   Comment("");
   ObjectsDeleteAll(0,"Box "      +TF);
   ObjectsDeleteAll(0,"Pair "     +TF);
   ObjectsDeleteAll(0,"Value "    +TF);
   ObjectsDeleteAll(0,"Majors "   +TF);
   ObjectsDeleteAll(0,"Currency " +TF);
   ObjectsDeleteAll(0,"TimeFrame "+TF);
   ObjectsDeleteAll(0,"Period "   +TF);

   ChartRedraw();
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tickVolume[],
                const long &volume[],
                const int &spread[])
{
      // код доступен только после оплаты
   }

void OnTimer()
{
   int i, currentSymbolsTotal = SymbolsTotal(true);

   if(symbolsTotal != currentSymbolsTotal)
   {
   ArrayResize(watchList,currentSymbolsTotal);
      for(i=0;i<currentSymbolsTotal;i++) 
      {
      watchList[i] = SymbolName(i,true);
      if(symbolPrefix != "") watchList[i] = StringSubstr(SymbolName(i,true),StringLen(symbolPrefix),StringLen(Symbol()));
	   if(symbolSuffix != "") watchList[i] = StringSubstr(watchList[i],0,StringLen(watchList[i]) - StringLen(symbolSuffix));
      }
   symbolsTotal = currentSymbolsTotal;
   }

   if(levelsAlertMode > 0 || currencyAlertOn || pushNotificationOn)
   {
      if(firstTime)
      {
         if(levelsAlertMode > 0 || pushNotificationOn)
         {   
         ArrayResize(prevmess,symbolsTotal);
         for(i=0;i<symbolsTotal;i++) prevmess[i] = IndicatorName + "(" + TF + ")" + " : " + watchList[i]; 
         }

         if(currencyAlertOn || pushNotificationOn)
         { 
         ArrayResize(curmess ,ArraySize(currencies));
         for(i=0;i<ArraySize(currencies);i++) curmess[i] = IndicatorName + "(" + TF + ")" + " : " + currencies[i];         
         }
      firstTime = false;
      }
   }

   currencyStrengBoard(); 

   ChartRedraw();
}

int prev_x, prev_y;

void currencyStrengBoard()
{
   int    kk[], color1, color2, color3, bwidth;
   double pairChange[], sumChange, currencyPower[], sortedChange[], sortedPower[], ratio[], compactRatio = 0;
   string maxChgPair, minChgPair, sortedPair[], plus;
   color  textcolor, bordercolor, boxColor;  
   bool   strongest = false, weakest = false;  

   ArrayResize(kk           ,num);
   ArrayResize(currencyPower,num);
   ArrayResize(sortedPower  ,num);
   ArrayResize(pairChange   ,num*num);
   ArrayResize(pairs        ,num*num);

   checkCoordinates(0,"TimeFrame "+TF,offset_x,offset_y);

   if(offset_x != prev_x || offset_y != prev_y)
   {
   refresh = 1;
   prev_x = offset_x;
   prev_y = offset_y; 
   }
   else refresh = 5;

   double maxChange = -1000;
   double minChange =  1000;   

   for(int i=0;i<num;i++)
   {
   int k =-1;   
   sumChange = 0;
      for(int j=0;j<num;j++)
      {
      string baseCurrency  = currencies[i];
      string quoteCurrency = currencies[j]; 
      string pair  = "";

      int sign = 0;
      string symbol = "";

         if(findStringInArray(baseCurrency + quoteCurrency,watchList)) {sign = 1; pair = baseCurrency  + quoteCurrency;}
         else 
         if(findStringInArray(quoteCurrency + baseCurrency,watchList)) {sign =-1; pair = quoteCurrency + baseCurrency; }   
         else continue;

      symbol = symbolPrefix + pair + symbolSuffix;

         if(CopyRates(symbol,timeFrame,0,2,mtfBar) == 2)
         {
            if(sign != 0) 
            {
            k++;

            pairs[i*num+k] = pair; 

               if(showInPips) 
               {
                  if(i < num && k < num && once == true)
                  {
                  int    _digits = (int)MarketInfo(pair,MODE_DIGITS); 
                  pairPoint[i*num+k]  = MarketInfo(pair,MODE_POINT)*MathPow(10,_digits%2);
                  if(i == num - 1 && k == num - 2) once = false; 
                  }
               pairChange[i*num+k] = sign*((mtfBar[0].close - mtfBar[1].close)/pairPoint[i*num+k]); 
               }
               else
               pairChange[i*num+k] = sign*((mtfBar[0].close/mtfBar[1].close) - 1)*100; 

            if(outsymbol == pairs[i*num+k]) outchange[0] = pairChange[i*num+k];

            sumChange += pairChange[i*num+k];

            if(pairChange[i*num+k] > maxChange) {maxChange = pairChange[i*num+k]; maxChgPair = pairs[i*num+k];}  
            if(pairChange[i*num+k] < minChange) {minChange = pairChange[i*num+k]; minChgPair = pairs[i*num+k];} 
            }
         }
         else
         { 

         SymbolSelect(symbol,true); 
         continue;
         }
      }
   kk[i] = k + 1;
   currencyPower[i] = sumChange;///(k + 1);  
   sortedPower[i]   = currencyPower[i];
   }

   ArraySort(sortedPower);   
   double maxPower = sortedPower[num-1]; 
   double minPower = sortedPower[0];

   for(int i=0;i<num;i++)
   {
   ArrayResize(sortedChange,kk[i]);

   for(int k=0;k<kk[i];k++)  sortedChange[k] = pairChange[i*num+k];  

   ArraySort(sortedChange);

   int sortedsize = ArraySize(sortedChange);

   ArrayResize(sortedPair,sortedsize);
   ArrayResize(ratio     ,sortedsize);

      for(int j=0;j<sortedsize;j++)
      {
         for(int k=0;k<kk[i];k++)
         {  
            if(sortedChange[k] == pairChange[i*num+j]) 
            {
            sortedPair[k] = pairs[i*num+j]; 
            ratio[k]      = sortedChange[k]/maxChange;
            if(outsymbol == sortedPair[k]) outratio[0] = ratio[k];
            break;
            }
         }   
      }   

      int pos = 0, neg = 0, sdig = 2;
      bool extremeStrong = false;
      bool veryStrong    = false;
      bool strong        = false; 
      string pct  = "%";

      if(showInPips) {pct = ""; sdig = 1;} 

      for(int k=0;k<sortedsize;k++)
      {
         if(ratio[k] >= 0)
         {
            if(!compactModeOn)
            {
            pos++;
            color1 = (int)(strongR + (1 - ratio[k])*(neutralR - strongR));
            color2 = (int)(strongG + (1 - ratio[k])*(neutralG - strongG));
            color3 = (int)(strongB + (1 - ratio[k])*(neutralB - strongB));

            if(ratio[k] > 0.5) textcolor = clrWhite; else textcolor = clrBlack; 
            if(ratio[k] >   0) plus = "+"; else plus = "";

            SetBox ("Box "  +TF+" "+currencies[i]+IntegerToString(k),0,(int)(offset_x+(i+1)*52*scale),(int)(offset_y+pos*32*scale),(int)(50*scale),(int)(30*scale),rgbToColor(color1,color2,color3),0,borderColor,1);
            SetText("Pair " +TF+" "+currencies[i]+IntegerToString(k),sortedPair[k],(int)(offset_x+3*scale+(i+1)*52*scale),(int)(offset_y+2*scale+pos*32*scale),textcolor,fontSize);
            SetText("Value "+TF+" "+currencies[i]+IntegerToString(k),stringCenter(plus+DoubleToString(sortedChange[k],sdig)+pct,9," "),(int)(offset_x+2*scale+(i+1)*52*scale),(int)(offset_y+14*scale+pos*32*scale),textcolor,fontSize);
            }

            if(levelsAlertMode > 0 || pushNotificationOn)
            {
            bool popup = levelsAlertMode > 0; 
            if((levelsAlertMode == 1 || levelsAlertMode == 2) && extremeStrongLevel > 0) extremeStrong  = ratio[k] > extremeStrongLevel/100; else extremeStrong = false;
            if((levelsAlertMode == 1 || levelsAlertMode == 3) && veryStrongLevel    > 0) veryStrong     = ratio[k] > veryStrongLevel/100; else veryStrong = false;                
            if((levelsAlertMode == 1 || levelsAlertMode == 4) && strongLevel        > 0) strong         = ratio[k] > strongLevel/100; else strong = false;

               if(currencies[i] == StringSubstr(sortedPair[k],0,3))
               {   
                  if(extremeStrong && ((levelsAlertMode == 1 || levelsAlertMode == 2) || pushNotificationOn)) pairBoxAlert(extremeStrong,sortedPair[k]," is extreme bullish!",popup,pushNotificationOn);   
                  else
                  if(veryStrong    && ((levelsAlertMode == 1 || levelsAlertMode == 3) || pushNotificationOn)) pairBoxAlert(veryStrong   ,sortedPair[k]," is very bullish!",popup,pushNotificationOn);   
                  else               
                  if(strong        && ((levelsAlertMode == 1 || levelsAlertMode == 4) || pushNotificationOn)) pairBoxAlert(strong       ,sortedPair[k]," is bullish!",popup,pushNotificationOn);   
               }
               else
               if(currencies[i] == StringSubstr(sortedPair[k],3,3))
               {   
                  if(extremeStrong && ((levelsAlertMode == 1 || levelsAlertMode == 2) || pushNotificationOn)) pairBoxAlert(extremeStrong,sortedPair[k]," is extreme bearish!",popup,pushNotificationOn);   
                  else
                  if(veryStrong    && ((levelsAlertMode == 1 || levelsAlertMode == 3) || pushNotificationOn)) pairBoxAlert(veryStrong   ,sortedPair[k]," is very bearish!",popup,pushNotificationOn);   
                  else               
                  if(strong        && ((levelsAlertMode == 1 || levelsAlertMode == 4) || pushNotificationOn)) pairBoxAlert(strong       ,sortedPair[k]," is bearish!",popup,pushNotificationOn);   
               }
            }
         }
      }

      for(int k=sor

Показано первые 50% кода (символов: 17642)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
1 764,20₽ ≈ $21.56