Complete my multi--timeframe-multi-currency-indicator (easy for a coder)

MQL4 Индикаторы

Работа завершена

Время выполнения 2 минуты

Техническое задание

Hi coders,

I coded a matrix-indicator which checks if the last closed bar is a pinbar which is simply defined as a bar with a 75% shadow. This checks are made in all timeframes and all currency pairs. It works fine and has just one small bug: the indicator checks all currencies and all timeframes with every tick. And that is wasting much computer calculation time. I want that the M5 timeframe will only be checked at the open of a new M5 bar, the same with all other timeframes. So if I want to check the M1 chart, the indicator's fastest refresh-rate should be once a minute.

According to that I want an Alert to be displayed when conditions are met. At the moment the Alerts are based on Time[0] and I know that is wrong because the bar in the corresponding timeframe has to be checked and not the bar which is displayed in the current chart.

I think every coder will solve this problem within some minutes but I am a beginner and I am still very poor in MQL4-specific data types, syntax and structure.

Here is my code:

//+------------------------------------------------------------------+
//|                                               Pinbar-Scanner.mq4 |
//|                                               Copyright 2013, MR |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MR"
#property link      ""

#property indicator_chart_window

extern bool M1  = true;
extern bool M5  = true;
extern bool M15 = true;
extern bool M30 = true;
extern bool H1  = true;
extern bool H4  = true;
extern bool D1  = true;
extern bool W1  = true;

string Timeframe[];
int TimeframeNo[];
string CurrPair[] = {"AUDCAD", "AUDCHF", "AUDJPY", "AUDNZD", "AUDUSD", "CADCHF", "CHFJPY", "EURAUD",
                     "EURCAD", "EURCHF", "EURGBP", "EURJPY", "EURNZD", "EURUSD", "GBPAUD", "GBPCAD",
                     "GBPCHF", "GBPJPY", "GBPNZD", "GBPUSD", "NZDJPY", "NZDUSD", "USDCAD", "USDCHF",
                     "USDJPY"};
color col;
bool PinbarLong, PinbarShort;
int dist_X, dist_Y, i, j;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
//---- Arrays population ----
   if (M1)
   {
      ArrayResize(Timeframe, ArraySize(Timeframe)+1);
      Timeframe[ArraySize(Timeframe)-1]="M1";
      ArrayResize(TimeframeNo, ArraySize(TimeframeNo)+1);
      TimeframeNo[ArraySize(TimeframeNo)-1]=PERIOD_M1;
   }
   if (M5)
   {
      ArrayResize(Timeframe, ArraySize(Timeframe)+1);
      Timeframe[ArraySize(Timeframe)-1]="M5";
      ArrayResize(TimeframeNo, ArraySize(TimeframeNo)+1);
      TimeframeNo[ArraySize(TimeframeNo)-1]=PERIOD_M5;
   }
   if (M15)
   {
      ArrayResize(Timeframe, ArraySize(Timeframe)+1);
      Timeframe[ArraySize(Timeframe)-1]="M15";
      ArrayResize(TimeframeNo, ArraySize(TimeframeNo)+1);
      TimeframeNo[ArraySize(TimeframeNo)-1]=PERIOD_M15;
   }
   if (M30)
   {
      ArrayResize(Timeframe, ArraySize(Timeframe)+1);
      Timeframe[ArraySize(Timeframe)-1]="M30";
      ArrayResize(TimeframeNo, ArraySize(TimeframeNo)+1);
      TimeframeNo[ArraySize(TimeframeNo)-1]=PERIOD_M30;
   }
   if (H1)
   {
      ArrayResize(Timeframe, ArraySize(Timeframe)+1);
      Timeframe[ArraySize(Timeframe)-1]="H1";
      ArrayResize(TimeframeNo, ArraySize(TimeframeNo)+1);
      TimeframeNo[ArraySize(TimeframeNo)-1]=PERIOD_H1;
   }
   if (H4)
   {
      ArrayResize(Timeframe, ArraySize(Timeframe)+1);
      Timeframe[ArraySize(Timeframe)-1]="H4";
      ArrayResize(TimeframeNo, ArraySize(TimeframeNo)+1);
      TimeframeNo[ArraySize(TimeframeNo)-1]=PERIOD_H4;
   }
   if (D1)
   {
      ArrayResize(Timeframe, ArraySize(Timeframe)+1);
      Timeframe[ArraySize(Timeframe)-1]="D1";
      ArrayResize(TimeframeNo, ArraySize(TimeframeNo)+1);
      TimeframeNo[ArraySize(TimeframeNo)-1]=PERIOD_D1;
   }
   if (W1)
   {
      ArrayResize(Timeframe, ArraySize(Timeframe)+1);
      Timeframe[ArraySize(Timeframe)-1]="W1";
      ArrayResize(TimeframeNo, ArraySize(TimeframeNo)+1);
      TimeframeNo[ArraySize(TimeframeNo)-1]=PERIOD_W1;
   }

//---- Timeframe Objects ----
   dist_X = 80;
   for(i=0; i<=ArrayRange(Timeframe,0)-1; i++)
   {
      if (ObjectFind(Timeframe[i]+"txt") == -1)
      {
         ObjectCreate(Timeframe[i]+"txt", OBJ_LABEL, 0, 0, 0);
         ObjectSet(Timeframe[i]+"txt", OBJPROP_CORNER, 0);
         ObjectSet(Timeframe[i]+"txt", OBJPROP_XDISTANCE, dist_X);
         ObjectSet(Timeframe[i]+"txt", OBJPROP_YDISTANCE, 0);
         ObjectSetText(Timeframe[i]+"txt", Timeframe[i], 9, "Calibri", White);
         dist_X = dist_X+40;     
      }
   }
   
//---- Currency pairs objects ----
   dist_Y = 30;
   for(i=0; i<=ArrayRange(CurrPair,0)-1; i++)
   {
      if (ObjectFind(CurrPair[i]+"txt") == -1)
      {
         ObjectCreate(CurrPair[i]+"txt", OBJ_LABEL, 0, 0, 0);
         ObjectSet(CurrPair[i]+"txt", OBJPROP_CORNER, 0);
         ObjectSet(CurrPair[i]+"txt", OBJPROP_XDISTANCE, 0);
         ObjectSet(CurrPair[i]+"txt", OBJPROP_YDISTANCE, dist_Y);
         ObjectSetText(CurrPair[i]+"txt", CurrPair[i], 9, "Calibri", White);
         dist_Y = dist_Y+17;     
      }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   static datetime Time0;

//---- Dot matrix ----   
   dist_X=80;
   dist_Y=4;
   for(j=0; j<=ArrayRange(Timeframe,0)-1; j++)
   {
      for(i=0; i<=ArrayRange(CurrPair,0)-1; i++)
      {
         ObjectCreate(CurrPair[i]+Timeframe[j], OBJ_LABEL, 0, 0, 0);
         ObjectSet(CurrPair[i]+Timeframe[j], OBJPROP_CORNER, 0);
         ObjectSet(CurrPair[i]+Timeframe[j], OBJPROP_XDISTANCE, dist_X);
         ObjectSet(CurrPair[i]+Timeframe[j], OBJPROP_YDISTANCE, dist_Y);
         
//-- Conditions --
         PinbarLong =   MathMin(iOpen(CurrPair[i], TimeframeNo[j], 1),iClose(CurrPair[i], TimeframeNo[j], 1))-
                        iLow(CurrPair[i], TimeframeNo[j], 1)
                        >= (iHigh(CurrPair[i], TimeframeNo[j], 1)-iLow(CurrPair[i], TimeframeNo[j], 1))*0.75;
         
         PinbarShort =  iHigh(CurrPair[i], TimeframeNo[j], 1)-
                        MathMax(iOpen(CurrPair[i], TimeframeNo[j], 1),iClose(CurrPair[i], TimeframeNo[j], 1))
                        >= (iHigh(CurrPair[i], TimeframeNo[j], 1)-iLow(CurrPair[i], TimeframeNo[j], 1))*0.75;
         
//--  Alert --          
         if (PinbarLong)
         {
            col=Lime;
            if (Time0 != Time[0])
            {
               Alert(CurrPair[i]+" "+Timeframe[j]+" Pinbar Long");
               Time0 = Time[0];
            }
         }
         else if (PinbarShort)
         {
            col=Red;
            if (Time0 != Time[0])
            {
               Alert(CurrPair[i]+" "+Timeframe[j]+" Pinbar Short");
               Time0 = Time[0];
            }
         }
         else
         {
            col=Gray;
         }
         
//-- Dot Matrix --
         ObjectSetText(CurrPair[i]+Timeframe[j], "-", 35, "Calibri", col);   
         dist_Y = dist_Y+17;
      }
      dist_Y=4;
      dist_X=dist_X+40;     
   }
   WindowRedraw();
//----
   return(0);
  }
//+------------------------------------------------------------------+

If you would like to complete my code, please tell me what price it will be.

Thank you!

PS: If you attach this indicator to your chart, please set all chart colors to "None".

Откликнулись

1
Разработчик 1
Оценка
(118)
Проекты
201
42%
Арбитраж
44
9% / 68%
Просрочено
47
23%
Свободен
Похожие заказы
Hi, i need a Expert Advisor, that can pass prop firm Challenges like FTMO / E8 / 1OF1FUNDING Profit 10% Max Drawdown (DD) 10% Max Daily Loss 4% All trades with SL NO trades during and after high impact news NO trades during Weekend Profitable backtest from 2010 to 2024 Trades Forex (If you already have a finished EA, send me the backtest) PLease contact me asap
Pls guys I need help. About the file i need I have ea ex4 file but it use to set buystop or sellstop oders etc now what I want is to fit the propfirm am using because the propfirm am using have a lot size consistency rules so what I need is even if the ea set multiple buystop the file will only allow the ea to pick 2 positions and automatically delete the nearest limit Oder it can only allow the ea buystop or new
Expert Advisor 100 - 200 USD
Hello, I would like to create an EA based on several indicators with various signals that can be activated or not for optimization purposes. It includes basic money management such as SL/TP, BE, trailstop. Please check the attached specifications carefully to confirm that you are able of achieving it 100% before offering your services. THANKS
MT4 Indicator 30 - 65 USD
hello i would create a mt4 indicator with my requirements from stratch, more info on message please apply only if you can consider my budget i need also some day to test it
Below are the conditions of the indicator: Buy Conditions: The first candle must open and close bearish. The second candle must open and close bullish. Both candles must have a body (not a doji). The close of the first candle must be the same as the open of the second candle (with an exception for a difference of not more than 2 pips). The third candle must open and close bearish, and its close must be below the
Firstly Indicator (1) or the first part \\ Draw a red line at the top of the zero candle _ M1 \\ Draw a blue line at the bottom of the zero _ M1 candle \\ Draw a red line at the top of the zero _ M2 candle \\ Draw a blue line at the bottom of the zero _ M2 candle \\ Draw a red line at the top of the zero candle _ M3 \\ Draw a blue line at the bottom of the zero _ M3 candle \\ Draw a red line at the top of the zero
本人现有一个网格EA,内有马丁加仓平仓,需要升级,加入对冲功能和其他功能.(其他细节后谈) 1 . 網格繫統:可選:YES/NO. 如果:YES,設置:網格間隔,網格層數, 2 . 開倉:條件開倉,可選:YES/NO.(目前默認爲NO) 分爲市價開倉/STOP ORDER/ LIMIT ORDER, 3 . 加倉:分爲:固定手數,如:0 . 03,或末單累加:0 . 01,或:末單倍數如:1 . 5倍.多單和空單的加倉方法可以不同設置. 4 . 移動止盈.(單獨移動,多/空方整體點數移動/或金額移動) 5 . 平倉包括: A.多方/空方止盈線,和多方/空方止損線(可以設置三條價格:每條選擇:平倉 1/3,1/2,或全部) B.單獨止盈/止損 (多方和空方可以設置不同的,)盈利點數或金額 整體止盈/止損.(多方和空方可以設置不同的,)
This indictor is a simple entry candle kind of indicator using moving average. I had given the rules and condition for this as easy as possible for a sell example. You can Chek the below link for a whole document and let me know if any queries. Looking forward to work with you. https://docs.google.com/document/d/1K_H2ynkmJVRAvck3MYkE88KI6Tb092x1/edit?usp=drivesdk&amp ;ouid=116017681189749572696&rtpof=true&sd=true
I need to convert a short 30 Line pinescript to Tradestation Easy Language, I want this project to be completed in 2-3 days if possible? Kindly apply if this is what you can do, i will include the script in the attachment below
i am currently in need of someone who can be able to help me out.i want my custom indicator to be non repainting and i also want the custom indicator to be able to send out all types of alerts...thank you

Информация о проекте

Бюджет
10 - 30 USD
VAT (19%): 1.9 - 5.7 USD
Итого: 11.9 - 35.7 USD
Исполнителю
9 - 27 USD