NO LINKS, SOURCE CODE REQUESTS OR MODIFICATION OF DECOMPILED INDICATORS. To avoid post deletion please follow the rules.

This interesting moving average alert indicator is not updating as it should...

#1
Hello everyone I am new to the forum so greet all those who are part of it.

the indicator in question gives the opportunity to insert the bars to be scanned for the alert, the problem is that if I insert a number of bars higher than the history, the indicator no longer updates or even disappears.
I tried to modify it and I deleted some include files that didn't do much good.

Anyone know how to fix this?
I saw that there are some very good programmers in the forum ...
Moving Average With Alert.mq4
(8.76 KiB) Downloaded 134 times


Re: This interesting moving average alert indicator is not updating as it should...

#2
frenk wrote:
Thu Feb 11, 2021 6:16 am
Hello everyone I am new to the forum so greet all those who are part of it.

the indicator in question gives the opportunity to insert the bars to be scanned for the alert, the problem is that if I insert a number of bars higher than the history, the indicator no longer updates or even disappears.
I tried to modify it and I deleted some include files that didn't do much good.

Anyone know how to fix this?
I saw that there are some very good programmers in the forum ...
Maybe this one Averages

Re: This interesting moving average alert indicator is not updating as it should...

#3
Thanks for the prompt reply, I have already seen this very comprehensive moving average indicator.
I wanted to use the SMMA and I believe that the average indicator 9.4 and earlier with longer averages of the type 200 or 400 tends to twist on the price and then start, also in this case with not very long histories it tends not to give optimal values, in practice, the average starts from the candle, while the indicator I posted is like the standard moving average smoothed of MT, if possible I wanted to try to fix and maybe improve mine.

I hope there is more help

I also insert the vidya because it can be useful for someone
averages - mtf - alerts 9.0.ex4
(154.42 KiB) Downloaded 124 times
averages - mtf - alerts 9.2.ex4
(155.61 KiB) Downloaded 159 times
Vidya cmo 1.1 (alerts + arrows).ex4
(24.44 KiB) Downloaded 176 times


Re: This interesting moving average alert indicator is not updating as it should...

#6
ChuChu Rocket wrote:
Sat Feb 13, 2021 12:13 am
frenk wrote:
Fri Feb 12, 2021 11:25 pm
Anyone who knows MT4 programmer to solve the Moving Average With Alert.mq4 problem?
Are you not able to use the other Moving Average indicators posted above or in the link posted by Mrtools?
Hi,

Of course I know how to use them and I have also made the previous versions available but in a not too long history D1 or W1 or MN some of the moving averages such as the SMMA do not work as well as the standard MT SMMA (the reason I wrote in the previous post) .
If it is possible to solve the problem of the Moving Average With Alert indicator, in the future it would be interesting to be able to insert the Vidya CMO 1.1, making a single indicator.

Re: This interesting moving average alert indicator is not updating as it should...

#7
I resume this post to ask if someone who knows the MT4 language can help me insert in the classic moving average vidya a further smoothing with the classic moving averages Simple, Exponential, Smoothed, Linear Weighted.
I tried but my programming level is at the beginning, I put the code of the classic Vidya.
Thanks to whoever intervenes

//+------------------------------------------------------------------+
//| Vidya Prova.mq4 |
//| Io |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 clrMagenta
#property indicator_width1 0
#property strict

//
//
//
//
//

extern int CmoPeriod1 = 15; // CMO period
extern int SmoothPeriod1 = 15; // Smoothing period
extern int MA = 15; // Smoothing SMA
extern ENUM_APPLIED_PRICE Price1 = PRICE_CLOSE; // Price

double val[],valda[],valdb[],slope[];

//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//

int init()
{
IndicatorBuffers(4);
SetIndexBuffer(0,val);
SetIndexBuffer(1,valda);
SetIndexBuffer(2,valdb);
SetIndexBuffer(3,slope);
return(0);
}

//
//
//
//
//

int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);

//
//
//
//
//

if (slope[limit]==-1) CleanPoint(limit,valda,valdb);
for(int i=limit; i>=0; i--)
{

val= iVidya(iMA(NULL,0,1,0,MODE_SMA,Price1,i),CmoPeriod1,SmoothPeriod1,i,0);
valda = EMPTY_VALUE;
valdb = EMPTY_VALUE;
slope = (i<Bars-1) ? (val>val[i+1]) ? 1 : (val<val[i+1]) ? -1 : slope[i+1] : 0;
if (slope==-1) PlotPoint(i,valda,valdb,val);
}
return(0);
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//

#define _vidyaInstances 1
#define _vidyaInstancesSize 2
double vidya_work[][_vidyaInstances*_vidyaInstancesSize];
#define vidya_price 0
#define vidya_value 1

double iVidya(double price, int cmoPeriods, int smoothPeriod, int i, int instanceNo=0)
{
if (ArrayRange(vidya_work,0)!=Bars) ArrayResize(vidya_work,Bars); int r = Bars-i-1; int s = instanceNo*_vidyaInstancesSize;

//
//
//
//
//

vidya_work[r][s+vidya_price] = price;
double sumUp = 0;
double sumDo = 0;
for (int j=0; j < cmoPeriods && (r-j-1)>=0; j++)
{
double diff = vidya_work[r-j][s+vidya_price]-vidya_work[r-j-1][s+vidya_price];
if (diff > 0)
sumUp += diff;
else sumDo -= diff;
}
double k = ((sumUp+sumDo)!=0) ? MathAbs((sumUp-sumDo)/(sumUp+sumDo)): 1;

vidya_work[r][s+vidya_value] = (r>0) ? vidya_work[r-1][s+vidya_value]+(k*2.00/(1.00+MathMax(smoothPeriod,1)))*(vidya_work[r][s+vidya_price]-vidya_work[r-1][s+vidya_value]) : price;
return(vidya_work[r][s+vidya_value]);
}

//-------------------------------------------------------------------
//
//-------------------------------------------------------------------
//
//
//
//
//

void CleanPoint(int i,double& first[],double& second[])
{
if ((second != EMPTY_VALUE) && (second[i+1] != EMPTY_VALUE))
second[i+1] = EMPTY_VALUE;
else
if ((first != EMPTY_VALUE) && (first[i+1] != EMPTY_VALUE) && (first[i+2] == EMPTY_VALUE))
first[i+1] = EMPTY_VALUE;
}

//
//
//
//
//

void PlotPoint(int i,double& first[],double& second[],double& from[])
{
if (i>=Bars-2) return;
if (first[i+1] == EMPTY_VALUE)
{
if (first[i+2] == EMPTY_VALUE)
{ first = from[i]; first[i+1] = from[i+1]; second[i] = EMPTY_VALUE; }
else { second[i] = from[i]; second[i+1] = from[i+1]; first[i] = EMPTY_VALUE; }
}
else { first[i] = from[i]; second[i] = EMPTY_VALUE; }
}

Re: This interesting moving average alert indicator is not updating as it should...

#8
frenk wrote:
Sun Aug 29, 2021 6:54 am
I resume this post to ask if someone who knows the MT4 language can help me insert in the classic moving average vidya a further smoothing with the classic moving averages Simple, Exponential, Smoothed, Linear Weighted.
I tried but my programming level is at the beginning, I put the code of the classic Vidya.
Thanks to whoever intervenes

And try more Vidya from Vidya and MA . So as not to run twice.:) (Switching from Vidya to MA in the code.)
Vidya cmo.ex4
(11.71 KiB) Downloaded 19 times
Vidya cmo.mq4
(2.88 KiB) Downloaded 24 times
Vidya cmo_2.ex4
(12.09 KiB) Downloaded 20 times
Vidya cmo_2.mq4
(3.1 KiB) Downloaded 22 times
Vidya cmo_ma.ex4
(13.44 KiB) Downloaded 23 times
Vidya cmo_ma.mq4
(3.13 KiB) Downloaded 25 times
22.JPG
23.JPG


Attachments 26
  1. Similar Topics

    1. Moving Average Breakout EA for MT5

      0 Replies 343 Views

      by forexeas, Fri Jul 02, 2021 7:24 pm in MT5 Indicators

      0 Replies
      343 Views
    2. This indicator is interesting, pls make an EA

      3 Replies 2503 Views

      by so2526, Sun Jan 17, 2021 11:44 pm in Coding Help

      3 Replies
      2503 Views
    3. Can someone add alert for this indicator please?

      0 Replies 192 Views

      by dieworm12, Thu Jun 24, 2021 9:26 pm in Coding Help

      0 Replies
      192 Views

Return to “MT4 Indicators”

Users viewing this forum: Bing [Bot], CommonCrawl [Bot], Dnsxx, DTRCT, Facebook [Crawler], IBM oBot [Bot], lyo99, mancangkul, OniAngel, Seznam [Bot], 太虚一毫 and 55 guests