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

MQL4 Göstergeler

İş tamamlandı

Tamamlanma süresi: 2 dakika

İş Gereklilikleri

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".

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(118)
Projeler
201
42%
Arabuluculuk
44
9% / 68%
Süresi dolmuş
47
23%
Ücretsiz
Benzer siparişler
Hello I am looking for a developer to help me backtest my custom ninjatrader 8 strategy andake it work perfectly your expertise is highly need for this project kindly reach out to me and let proceed
I have a documented strategy that I will like to have as mt5 or ctrader trading bot, kindly bid for this job to discuss about the job requirements i want a professional for this work
أولاً المؤشر (1) أو الجزء الأول \\ رسم خط أحمر في أعلى الشمعة الصفرية _ M1 \\ ارسم خطًا أزرقًا أسفل الشمعة صفر _ M1 \\ رسم خط أحمر في أعلى الشمعة صفر _ M2 \\ ارسم خطًا أزرقًا أسفل الشمعة صفر _ M2 \\ رسم خط أحمر في أعلى الشمعة الصفرية _ M3 \\ ارسم خطًا أزرقًا أسفل الشمعة صفر _ M3 \\ رسم خط أحمر أعلى الشمعة الصفرية _ M4 \\ ارسم خطًا أزرقًا أسفل الشمعة الصفرية _ M4 \\ رسم خط أحمر في أعلى الشمعة الصفرية _ M5 \\ ارسم خطًا
Hello please I need a developer to help me fix errors on my Ninjatrader 8 strategy I and make it work perfectly your expertise is need for this project kindly reach out to me and let's proceed
I need an alert of new zone created/show to be added to this supply demand indicator. Sound and pop-up alert option, no need for email alert. Max 3 days to deliver please. Thanks
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

Proje bilgisi

Bütçe
10 - 30 USD
KDV (19%): 1.9 - 5.7 USD
Toplam: 11.9 - 35.7 USD
Geliştirici için
9 - 27 USD