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

MQL4 Indicators

Job finished

Execution time 2 minutes

Specification

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

Responded

1
Developer 1
Rating
(118)
Projects
201
42%
Arbitration
44
9% / 68%
Overdue
47
23%
Free
Similar orders
Hi there Here is a video of the logic: its based on market structure and swings using validated highs and lows based on candle closure. Just in case you would like to take a look at the code/indicator here is the link: https://youtu.be/igj0OaQoM7o?si=7nigL8OU2Nt1Zxkx Let me know if you can help
I am looking for a professional developer to help me with creating a hedge grid bot. The concept is in the picture. The bot is quite simple. The bot basically opens buy and sell positions on each grid and self terminates when the upper limit (manually set is reached) 1. Set timer for new's releases (manual entry) 2. Slippage in pip's (manual entry) 3. Maximum drawdown in USD with self termination when entry
I need alerts for 2 kinds of triangles (contracting & expanding) and 2 kinds of channels (up & dn) before that you should be able to put trendlines to any buffered (usually 0 & 1) zigzag indicators the method of drawing trendline is different i can show them with the pictures
Nt8 30+ USD
I trade in NT8 and would like to code an Elliott wave measurment tool, which is very easy because I have the major Script for that.We need only to add some aspects into it. If you are interested,if you can do this do well to bid on it
Hi I am looking for converting an indicator from MT4 to Mt5 It is Tom De Mark sequential This code is based off of the Tom DeMark TD Sequential Indicator. Basic criteria is as follows: | | TD Setup | TD Countdown | |------------------ |---------------------------------------------------- |---------------------------------------------------|
Tradingview indicator 30 - 50 USD
Looking for a tradingview expert to do a quick job . It is an indicator so apply only if you are capable. Price is negotiable Check attached file and proofs that you can get it done perfectly
Blue Angel Shark 30 - 120 USD
I would like a coded indicator that is able to combine Smart money concept, Pure price Action and Pine script so as to spot trade entries by giving Take profits and Stop loss should also be compatible with all timeframes in trading and also work with all forex markets and Derived synthetic indices. I will upload a picture below. Kindly
I need you to convert this tradingview indicator (PineScript) to MT5. The indicator need to work in any time frame and as the proposed script. It need to plot the ATR bands (as you can see in the attached image) and work as the proposed routine of ATR bands, when price close above or below the bands, the bars will change color (as you can see in the script and the image attached). Instead of sending alerts of buying
"Seeking an adept developer to help realize my custom NT8 strategy. Your expertise is integral to achieving success in this project. Are you interested in teaming up for a productive collaboration? Let's discuss the details together. Thank you!"
NinjaTrader 8 indicator that plots open prices of higher time frame bars. Time frames to choose from in the properties: 15sec, 30sec, 1min, 5min, 15min, 30min, 1hr, 4hr, 1day, 1week, 1month, 1 year (or any time based periods if that would make the development easier). Ability to customize lines is needed (style, color, thickness, etc.). Also, ability to extend certain lines all the way to the right by clicking on

Project information

Budget
10 - 30 USD
VAT (19%): 1.9 - 5.7 USD
Total: 11.9 - 35.7 USD
For the developer
9 - 27 USD