fix mt4 indicator

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

fix mt4 indicator

Postby xzerax » Sat Dec 02, 2023 10:39 am

hi , can you please fix this indicator , it doesnt give live signals , it only gives history on some pairs only
Code: Select all
#property strict
#property indicator_chart_window
#property indicator_width1 3
#property indicator_width2 3
#property indicator_buffers 2
#property indicator_color1 Gold
#property indicator_color2 Purple
//+------------------------parameter---------------------------------+
double ExtMapBuffer1[];
double ExtMapBuffer2[];
extern int    CountBars  =5000;      //History 
extern int    tf1        =0; //TimeFrame 1 (0 Current)
extern int    tf2        =5; //TimeFrame 2
extern int    tf3        =15;//TimeFrame 3
extern int    tf4        =30;//TimeFrame 4
extern int    tf5        =60;//TimeFrame 5
//+------------------------------+
static int Signal = 0;
input bool EnableAlerts = true; // EnableAlerts

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   //---- indicators
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 234);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexEmptyValue(0, 0.0);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 233);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexEmptyValue(1, 0.0);
   //----
   return (0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   for (int i = CountBars; i >= 0; i--)
   {
      bool buy = false, sell = false;

      if (Open[i] < Close[i] &&
          iOpen(NULL, tf1, iBarShift(NULL, tf1, Time[i], false)) < iClose(NULL, tf1, iBarShift(NULL, tf1, Time[i], false)) &&
          iOpen(NULL, tf2, iBarShift(NULL, tf2, Time[i], false)) < iClose(NULL, tf2, iBarShift(NULL, tf2, Time[i], false)) &&
          iOpen(NULL, tf3, iBarShift(NULL, tf3, Time[i], false)) < iClose(NULL, tf3, iBarShift(NULL, tf3, Time[i], false)) &&
          iOpen(NULL, tf4, iBarShift(NULL, tf4, Time[i], false)) < iClose(NULL, tf4, iBarShift(NULL, tf4, Time[i], false)) &&
          iOpen(NULL, tf5, iBarShift(NULL, tf5, Time[i], false)) < iClose(NULL, tf5, iBarShift(NULL, tf5, Time[i], false)) && Signal != 1)
      {
         Signal = 1;
         buy = true;
         if (EnableAlerts) Alert("Buy Signal");
      }

      if (Open[i] > Close[i] &&
          iOpen(NULL, tf1, iBarShift(NULL, tf1, Time[i], false)) > iClose(NULL, tf1, iBarShift(NULL, tf1, Time[i], false)) &&
          iOpen(NULL, tf2, iBarShift(NULL, tf2, Time[i], false)) > iClose(NULL, tf2, iBarShift(NULL, tf2, Time[i], false)) &&
          iOpen(NULL, tf3, iBarShift(NULL, tf3, Time[i], false)) > iClose(NULL, tf3, iBarShift(NULL, tf3, Time[i], false)) &&
          iOpen(NULL, tf4, iBarShift(NULL, tf4, Time[i], false)) > iClose(NULL, tf4, iBarShift(NULL, tf4, Time[i], false)) &&
          iOpen(NULL, tf5, iBarShift(NULL, tf5, Time[i], false)) > iClose(NULL, tf5, iBarShift(NULL, tf5, Time[i], false)) && Signal != 2)
      {
         Signal = 2;
         sell = true;
         if (EnableAlerts) Alert("Sell Signal");
      }

      if (buy)
         ExtMapBuffer2[i - 1] = Low[i - 1];
      else
         ExtMapBuffer2[i - 1] = 0.0;

      if (sell)
         ExtMapBuffer1[i - 1] = High[i - 1];
      else
         ExtMapBuffer1[i - 1] = 0.0;
   }
   //----
   return (0);
}

xzerax
 
Posts: 12
Joined: Fri Mar 11, 2022 10:49 am

Re: fix mt4 indicator

Postby Apprentice » Tue Dec 05, 2023 7:04 am

We have added your request to the development list.
Development reference 1070
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36495
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia



Return to Indicator and Signal Requests

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 47 guests