Re: Dynamic Zone indicators for MT4

1061
mrtools wrote: Fri Jul 18, 2025 6:06 am The exact settings you are using is probably what is causing the problem, you are reversing the upper and lower bands!
So how are you checking for the break conditions???
The color of the bands has no influence on the value of the buffer.
So, if the issue is the color of the bands, then your code is flawed.
Otherwise, how am I reversing the upper and lower bands?
This is how I am using the indicator - it may not be the original idea, but I made this clear from the begining, didn't I?

Sorry check again!!!
Buffer3 is the lower buffer/band,
Buffer4 is the upper buffer/band


My idea is:

Code: Select all

string alertMessage = "";
if ( close[alertBar+1] < Buffer4[alertBar+1] && close[alertBar] > Buffer4[alertBar] )
  {
alertMessage = "_Symbol+" "+Tf_as_string(PERIOD_CURRENT)+"  Candle broke upper band UP !" ;
AlertOnce(alertMessage,alertBar,PERIOD_CURRENT);
 }
if ( close[alertBar+1] > Buffer4[alertBar+1] && close[alertBar] < Buffer4[alertBar] )
  {
alertMessage = "_Symbol+" "+Tf_as_string(PERIOD_CURRENT)+"  Candle broke upper band DOWN retest !" ;
AlertOnce(alertMessage,alertBar,PERIOD_CURRENT);
 }
if ( close[alertBar+1] > Buffer3[alertBar+1] && close[alertBar] < Buffer3[alertBar] )
  {
alertMessage = "_Symbol+" "+Tf_as_string(PERIOD_CURRENT)+"  Candle broke lower band DOWN !" ;
AlertOnce(alertMessage,alertBar,PERIOD_CURRENT);
 }
if ( close[alertBar+1] < Buffer3[alertBar+1] && close[alertBar] > Buffer3[alertBar] )
  {
alertMessage = "_Symbol+" "+Tf_as_string(PERIOD_CURRENT)+"  Candle broke lower band UP retest !" ;
AlertOnce(alertMessage,alertBar,PERIOD_CURRENT);
 }

//+------------------------------------------------------------------+
string   Tf_as_string(ENUM_TIMEFRAMES period){
   if(period == PERIOD_CURRENT)  period   = (ENUM_TIMEFRAMES) _Period;
   string   period_xxx  = EnumToString(period);                // PERIOD_XXX
   return StringSubstr(period_xxx, 7);                         // XXX
}
//+------------------------------------------------------------------+
int AlertOnce(string alert_msg, int ref, int tf)
{  
int i = 0;
  static int LastAlert[1000];

  while (i < 1000)
{
 if (ref == i)
  {
           if( LastAlert[i] == 0 || LastAlert[i] < iBars(NULL,tf) )
        {
           if(AlertPopUp)           Alert(MQLInfoString(MQL_PROGRAM_NAME)+" "+alert_msg);
           if(AlertSound&&!AlertPopUp)           PlaySound("alert.wav");
           if(AlertEMail)           SendMail(MQLInfoString(MQL_PROGRAM_NAME)+" Alert",alert_msg);
           if(AlertNotify)          SendNotification(alert_msg);
           LastAlert[i] = iBars(NULL,tf);
           return (1);
        }
      break;
 }
   
 i = i + 1;
  }
 return(0);  
}
//+------------------------------------------------------------------+


Re: Dynamic Zone indicators for MT4

1062
Dadas wrote: Fri Jul 18, 2025 6:48 am So how are you checking for the break conditions???
The color of the bands has no influence on the value of the buffer.
So, if the issue is the color of the bands, then your code is flawed.
Otherwise, how am I reversing the upper and lower bands?
This is how I am using the indicator - it may not be the original idea, but I made this clear from the begining, didn't I?

Sorry check again!!!
Buffer3 is the lower buffer/band,
Buffer4 is the upper buffer/band

My idea is:

Code: Select all

string alertMessage = "";
if ( close[alertBar+1] < Buffer4[alertBar+1] && close[alertBar] > Buffer4[alertBar] )
  {
alertMessage = "_Symbol+" "+Tf_as_string(PERIOD_CURRENT)+"  Candle broke upper band UP !" ;
AlertOnce(alertMessage,alertBar,PERIOD_CURRENT);
 }
if ( close[alertBar+1] > Buffer4[alertBar+1] && close[alertBar] < Buffer4[alertBar] )
  {
alertMessage = "_Symbol+" "+Tf_as_string(PERIOD_CURRENT)+"  Candle broke upper band DOWN retest !" ;
AlertOnce(alertMessage,alertBar,PERIOD_CURRENT);
 }
if ( close[alertBar+1] > Buffer3[alertBar+1] && close[alertBar] < Buffer3[alertBar] )
  {
alertMessage = "_Symbol+" "+Tf_as_string(PERIOD_CURRENT)+"  Candle broke lower band DOWN !" ;
AlertOnce(alertMessage,alertBar,PERIOD_CURRENT);
 }
if ( close[alertBar+1] < Buffer3[alertBar+1] && close[alertBar] > Buffer3[alertBar] )
  {
alertMessage = "_Symbol+" "+Tf_as_string(PERIOD_CURRENT)+"  Candle broke lower band UP retest !" ;
AlertOnce(alertMessage,alertBar,PERIOD_CURRENT);
 }

//+------------------------------------------------------------------+
string   Tf_as_string(ENUM_TIMEFRAMES period){
   if(period == PERIOD_CURRENT)  period   = (ENUM_TIMEFRAMES) _Period;
   string   period_xxx  = EnumToString(period);                // PERIOD_XXX
   return StringSubstr(period_xxx, 7);                         // XXX
}
//+------------------------------------------------------------------+
int AlertOnce(string alert_msg, int ref, int tf)
{  
int i = 0;
  static int LastAlert[1000];

  while (i < 1000)
{
 if (ref == i)
  {
           if( LastAlert[i] == 0 || LastAlert[i] < iBars(NULL,tf) )
        {
           if(AlertPopUp)           Alert(MQLInfoString(MQL_PROGRAM_NAME)+" "+alert_msg);
           if(AlertSound&&!AlertPopUp)           PlaySound("alert.wav");
           if(AlertEMail)           SendMail(MQLInfoString(MQL_PROGRAM_NAME)+" Alert",alert_msg);
           if(AlertNotify)          SendNotification(alert_msg);
           LastAlert[i] = iBars(NULL,tf);
           return (1);
        }
      break;
 }
   
 i = i + 1;
  }
 return(0);  
}
//+------------------------------------------------------------------+
Please tell me where the flawed alert code is

Code: Select all

if (inpAlertsHiLo) { trend[i] = (r>0) ? (high[i]>upb[i])  ? 1 : (low[i]<dnb[i])   ? -1 : (alertsOnEveryBreak && high[i]<upb[i]  && low[i]>dnb[i])   ? 0 : trend[i+1] : 0;  }
  else               { trend[i] = (r>0) ? (close[i]>upb[i]) ? 1 : (close[i]<dnb[i]) ? -1 : (alertsOnEveryBreak && close[i]<upb[i] && close[i]>dnb[i]) ? 0 : trend[i+1] : 0;  }   
upb = upper band and dnb = lower band???

Re: Dynamic Zone indicators for MT4

1063
mrtools wrote: Fri Jul 18, 2025 7:07 am Please tell me where the flawed alert code is

Code: Select all

if (inpAlertsHiLo) { trend[i] = (r>0) ? (high[i]>upb[i])  ? 1 : (low[i]<dnb[i])   ? -1 : (alertsOnEveryBreak && high[i]<upb[i]  && low[i]>dnb[i])   ? 0 : trend[i+1] : 0;  }
  else               { trend[i] = (r>0) ? (close[i]>upb[i]) ? 1 : (close[i]<dnb[i]) ? -1 : (alertsOnEveryBreak && close[i]<upb[i] && close[i]>dnb[i]) ? 0 : trend[i+1] : 0;  }   
upb = upper band and dnb = lower band???
I don't know what

Code: Select all

 trend[i]
is, and what r is, so I can't tell if that's correct or not.
I tested if alerts are working in general by a script, and they are.
So, if you can, please just do it my simple way and we will see if it works or not.
It can be a specific version just for me, if necessary.

Re: Dynamic Zone indicators for MT4

1064
mrtools wrote: Fri Jul 18, 2025 7:07 am Please tell me where the flawed alert code is

Code: Select all

if (inpAlertsHiLo) { trend[i] = (r>0) ? (high[i]>upb[i])  ? 1 : (low[i]<dnb[i])   ? -1 : (alertsOnEveryBreak && high[i]<upb[i]  && low[i]>dnb[i])   ? 0 : trend[i+1] : 0;  }
  else               { trend[i] = (r>0) ? (close[i]>upb[i]) ? 1 : (close[i]<dnb[i]) ? -1 : (alertsOnEveryBreak && close[i]<upb[i] && close[i]>dnb[i]) ? 0 : trend[i+1] : 0;  }   
upb = upper band and dnb = lower band???
Maybe you can do your own alerts with this version.
These users thanked the author mrtools for the post (total 2):
Dadas, kvak

Re: Dynamic Zone indicators for MT4

1065
mrtools wrote: Fri Jul 18, 2025 7:21 am Maybe you can do your own alerts with this version.
Much obliged and thanking You Very Much!!!
Though I would still like your version with working alerts as I need them...
I just want them to alert no matter of trend, just my simple conditions...

PS. My alerts are working as I want them in the basic indicator version which you gave.

PPS. I finally figured it out!
However, I did ask you if the DZ probability parameter was the culprit, and you didn't answer!!!
It turned out that 1.0 reverses the bands.
That would have solved the problem much earlier!!!

Thank you for everything!
And your patience!!!


Re: Dynamic Zone indicators for MT4

1067
BeatlemaniaSA wrote: Fri Mar 24, 2023 7:40 am Hi mrtools thanks for your awesome work.

I've compared the 2 versions and there is only one option missing in the latest version. It is the option of Jurik smoothing. Please see attached screenshot :)

ADX Trend.png

ADX Trend new.png

Warmest regards
BeatlemaniaSA
Hello people. I have been trying to incorporate this indicator into an EA but I have not had any success. Can someone assist me in the correct code to call and use this indicator please. Many Thanks
maahome

Re: Dynamic Zone indicators for MT4

1068
maahome wrote: Sat Jul 19, 2025 12:32 pm Hello people. I have been trying to incorporate this indicator into an EA but I have not had any success. Can someone assist me in the correct code to call and use this indicator please. Many Thanks
maahome
You use an indicator in an EA by iCustom().
However, there are certain issues:
1. If you want to use the default indicator parameters, then there is no problem, you just use the buffers which you want.
2. If you want to use your own custom parameters, then you need to reconstruct in the EA all of the input parameters above the highlighted one: And that also includes the enum for "Tiimeframes to use", and the enum for "Price".
You need to have the same input parameters in your EA, and feed them into the iCustom() in the exact same order, or it won't work.
It's a very boring and tedious job...
These users thanked the author Dadas for the post:
maahome

Re: Dynamic Zone indicators for MT4

1069
Dynamic Zones Heiken Ashi

This is an updated version of dynamic zones heiken ashi smoothed. Has a choice of 100+ moving averages for smoothing, with the possibility of double smoothing them which doubles the average possibilities to over 200 averages. Also, for display purposes can turn off the wicks to better see what is going on with price in relation to the heiken ashi.
These users thanked the author mrtools for the post (total 10):
RodrigoRT7, Jimmy, Ricstar_8, FredericoA, Akela, Sutatong, Krunal Gajjar, macd & rsi, thomdel, talaate

Re: Dynamic Zone indicators for MT4

1070
Dadas wrote: Sat Jul 19, 2025 11:10 pm You use an indicator in an EA by iCustom().
However, there are certain issues:
1. If you want to use the default indicator parameters, then there is no problem, you just use the buffers which you want.
2. If you want to use your own custom parameters, then you need to reconstruct in the EA all of the input parameters above the highlighted one:
2025-07-19_150337.jpg
And that also includes the enum for "Tiimeframes to use", and the enum for "Price".
You need to have the same input parameters in your EA, and feed them into the iCustom() in the exact same order, or it won't work.
It's a very boring and tedious job...
I have tried but it is beyond my skills unfortunately. On another possible request for MR To\ols perhaps. When I set the alert it provides a standard output no matter what chart, only difference is the time frame and currency pair. If I have 2 different instances with different settings on same timeframe and currency pairs then the alerts are time consuming. Is it possible for there to be an addition to the indi to allow for a custom alert comment?

Many thanks to all>