HOW TO USE MOVING AVARAGE OF ACCUMLATION DISTRIBUTION ?
-
GOOD DAY,

IN MT5, WHEN APPLYING MA INDICATOR IT IS POSSIBLE TO SELLECT UNDER IT IS POSSIBLE TO SELLECT "OTHER INDICATOR DATA" TO CREATE THE MOVING AVARAGE OF ACCOUMULAION DISTRBUTIO..
PLS HELP ME TO CREATE A CONDICTION IN FX DREEMA USING THIS IMPORTANT ADVANTAGE, TKS.
PLS SEE THE PRINT SCREEN ABOVE , TKS
RGDS -
No you unfortunately can't use another indicates data on FX with the standard blocks, you would have to get custom code to do it.
-
THANK YOU MR JSTAO FOR YOUR REPLAY , THIS IS THE CODE I CREATED IN A DIFFRENT WAY , MY PROBLEM IS HOW TO USE IN IN FXDREEMA... , I CAN NOT UNDERSTAND HOW TO DEAL WITH THE BUFFERS.. PLS TRY TO HELP , TKS:
//+------------------------------------------------------------------+
//| Indicator: MA OF AC COMPLETE STRATEGY.mq5 |
//| Created with EABuilder.com |
//| https://www.eabuilder.com |
//+------------------------------------------------------------------+
#property copyright "Created with EABuilder.com"
#property link "https://www.eabuilder.com"
#property version "1.00"
#property description ""//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2#property indicator_type1 DRAW_ARROW
#property indicator_width1 1
#property indicator_color1 0xFFAA00
#property indicator_label1 "Buy"#property indicator_type2 DRAW_ARROW
#property indicator_width2 1
#property indicator_color2 0x0000FF
#property indicator_label2 "Sell"#define PLOT_MAXIMUM_BARS_BACK 5000
#define OMIT_OLDEST_BARS 50//--- indicator buffers
double Buffer1[];
double Buffer2[];input int MA_PERIOD = 90;
input double DAILY_VOLUME_MULTIPLIER = 1;
input double HOURLY_VOLUMEMULTIPLIER = 1;
datetime time_alert; //used when sending alert
bool Audible_Alerts = true;
double myPoint; //initialized in OnInit
int AD_handle;
double AD[];
int AD_handle2;
double AD2[];
int MA_handle;
double MA[];
int MA_handle2;
double MA2[];
int MA_handle3;
double MA3[];
int MA_handle4;
double MA4[];
int Volumes_handle;
double Volumes[];
int Volumes_handle2;
double Volumes2[];
double Low[];
int ATR_handle;
double ATR[];
double High[];void myAlert(string type, string message)
{
if(type == "print")
Print(message);
else if(type == "error")
{
Print(type+" | MA OF AC COMPLETE STRATEGY @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
}
else if(type == "order")
{
}
else if(type == "modify")
{
}
else if(type == "indicator")
{
Print(type+" | MA OF AC COMPLETE STRATEGY @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
if(Audible_Alerts) Alert(type+" | MA OF AC COMPLETE STRATEGY @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
}
}//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0, Buffer1);
PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, MathMax(Bars(Symbol(), PERIOD_CURRENT)-PLOT_MAXIMUM_BARS_BACK+1, OMIT_OLDEST_BARS+1));
PlotIndexSetInteger(0, PLOT_ARROW, 241);
SetIndexBuffer(1, Buffer2);
PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(1, PLOT_DRAW_BEGIN, MathMax(Bars(Symbol(), PERIOD_CURRENT)-PLOT_MAXIMUM_BARS_BACK+1, OMIT_OLDEST_BARS+1));
PlotIndexSetInteger(1, PLOT_ARROW, 242);
//initialize myPoint
myPoint = Point();
if(Digits() == 5 || Digits() == 3)
{
myPoint *= 10;
}
AD_handle = iAD(NULL, PERIOD_D1, VOLUME_TICK);
if(AD_handle < 0)
{
Print("The creation of iAD has failed: AD_handle=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}AD_handle2 = iAD(NULL, PERIOD_H1, VOLUME_TICK);
if(AD_handle2 < 0)
{
Print("The creation of iAD has failed: AD_handle2=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}MA_handle = iMA(NULL, PERIOD_D1, MA_PERIOD, 1, MODE_LWMA, AD_handle);
if(MA_handle < 0)
{
Print("The creation of iMA has failed: MA_handle=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}MA_handle2 = iMA(NULL, PERIOD_D1, MA_PERIOD, 0, MODE_LWMA, AD_handle);
if(MA_handle2 < 0)
{
Print("The creation of iMA has failed: MA_handle2=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}MA_handle3 = iMA(NULL, PERIOD_H1, MA_PERIOD, 1, MODE_LWMA, AD_handle2);
if(MA_handle3 < 0)
{
Print("The creation of iMA has failed: MA_handle3=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}MA_handle4 = iMA(NULL, PERIOD_H1, MA_PERIOD, 0, MODE_LWMA, AD_handle2);
if(MA_handle4 < 0)
{
Print("The creation of iMA has failed: MA_handle4=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}Volumes_handle = iVolumes(NULL, PERIOD_D1, VOLUME_TICK);
if(Volumes_handle < 0)
{
Print("The creation of iVolumes has failed: Volumes_handle=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}Volumes_handle2 = iVolumes(NULL, PERIOD_H1, VOLUME_TICK);
if(Volumes_handle2 < 0)
{
Print("The creation of iVolumes has failed: Volumes_handle2=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}ATR_handle = iATR(NULL, PERIOD_CURRENT, 14);
if(ATR_handle < 0)
{
Print("The creation of iATR has failed: ATR_handle=", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);
}return(INIT_SUCCEEDED);
}//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
int limit = rates_total - prev_calculated;
//--- counting from 0 to rates_total
ArraySetAsSeries(Buffer1, true);
ArraySetAsSeries(Buffer2, true);
//--- initial zero
if(prev_calculated < 1)
{
ArrayInitialize(Buffer1, EMPTY_VALUE);
ArrayInitialize(Buffer2, EMPTY_VALUE);
}
else
limit++;
datetime Time[];datetime TimeShift[];
if(CopyTime(Symbol(), PERIOD_CURRENT, 0, rates_total, TimeShift) <= 0) return(rates_total);
ArraySetAsSeries(TimeShift, true);
int barshift_D1[];
ArrayResize(barshift_D1, rates_total);
int barshift_H1[];
ArrayResize(barshift_H1, rates_total);
for(int i = 0; i < rates_total; i++)
{
barshift_D1[i] = iBarShift(Symbol(), PERIOD_D1, TimeShift[i]);
barshift_H1[i] = iBarShift(Symbol(), PERIOD_H1, TimeShift[i]);
}
if(BarsCalculated(AD_handle) <= 0)
return(0);
if(CopyBuffer(AD_handle, 0, 0, rates_total, AD) <= 0) return(rates_total);
ArraySetAsSeries(AD, true);
if(BarsCalculated(MA_handle) <= 0)
return(0);
if(CopyBuffer(MA_handle, 0, 0, rates_total, MA) <= 0) return(rates_total);
ArraySetAsSeries(MA, true);
if(BarsCalculated(MA_handle2) <= 0)
return(0);
if(CopyBuffer(MA_handle2, 0, 0, rates_total, MA2) <= 0) return(rates_total);
ArraySetAsSeries(MA2, true);
if(BarsCalculated(AD_handle2) <= 0)
return(0);
if(CopyBuffer(AD_handle2, 0, 0, rates_total, AD2) <= 0) return(rates_total);
ArraySetAsSeries(AD2, true);
if(BarsCalculated(MA_handle3) <= 0)
return(0);
if(CopyBuffer(MA_handle3, 0, 0, rates_total, MA3) <= 0) return(rates_total);
ArraySetAsSeries(MA3, true);
if(BarsCalculated(MA_handle4) <= 0)
return(0);
if(CopyBuffer(MA_handle4, 0, 0, rates_total, MA4) <= 0) return(rates_total);
ArraySetAsSeries(MA4, true);
if(BarsCalculated(Volumes_handle) <= 0)
return(0);
if(CopyBuffer(Volumes_handle, 0, 0, rates_total, Volumes) <= 0) return(rates_total);
ArraySetAsSeries(Volumes, true);
if(BarsCalculated(Volumes_handle2) <= 0)
return(0);
if(CopyBuffer(Volumes_handle2, 0, 0, rates_total, Volumes2) <= 0) return(rates_total);
ArraySetAsSeries(Volumes2, true);
if(CopyLow(Symbol(), PERIOD_CURRENT, 0, rates_total, Low) <= 0) return(rates_total);
ArraySetAsSeries(Low, true);
if(BarsCalculated(ATR_handle) <= 0)
return(0);
if(CopyBuffer(ATR_handle, 0, 0, rates_total, ATR) <= 0) return(rates_total);
ArraySetAsSeries(ATR, true);
if(CopyHigh(Symbol(), PERIOD_CURRENT, 0, rates_total, High) <= 0) return(rates_total);
ArraySetAsSeries(High, true);
if(CopyTime(Symbol(), Period(), 0, rates_total, Time) <= 0) return(rates_total);
ArraySetAsSeries(Time, true);
//--- main loop
for(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(PLOT_MAXIMUM_BARS_BACK-1, rates_total-1-OMIT_OLDEST_BARS)) continue; //omit some old rates to prevent "Array out of range" or slow calculationif(barshift_D1[i] < 0 || barshift_D1[i] >= rates_total) continue; if(barshift_H1[i] < 0 || barshift_H1[i] >= rates_total) continue; //Indicator Buffer 1 if(AD[barshift_D1[i]] > AD[1+barshift_D1[i]] / MA[1+barshift_D1[i]] * MA2[barshift_D1[i]] //Accumulation / Distribution > Accumulation / Distribution / Moving Average * Moving Average && AD2[barshift_H1[i]] > AD2[1+barshift_H1[i]] / MA3[1+barshift_H1[i]] * MA4[barshift_H1[i]] //Accumulation / Distribution > Accumulation / Distribution / Moving Average * Moving Average && Volumes[barshift_D1[i]] > Volumes[1+barshift_D1[i]] * DAILY_VOLUME_MULTIPLIER //Volumes > Volumes * fixed value && Volumes2[barshift_H1[i]] > Volumes2[1+barshift_H1[i]] / HOURLY_VOLUMEMULTIPLIER //Volumes > Volumes / fixed value ) { Buffer1[i] = Low[i] + ATR[i]; //Set indicator value at Candlestick Low + Average True Range if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Buy"); time_alert = Time[0]; } //Instant alert, only once per bar } else { Buffer1[i] = EMPTY_VALUE; } //Indicator Buffer 2 if(AD[barshift_D1[i]] < AD[1+barshift_D1[i]] / MA[1+barshift_D1[i]] * MA2[barshift_D1[i]] //Accumulation / Distribution < Accumulation / Distribution / Moving Average * Moving Average && AD2[barshift_H1[i]] < AD2[1+barshift_H1[i]] / MA3[1+barshift_H1[i]] * MA4[barshift_H1[i]] //Accumulation / Distribution < Accumulation / Distribution / Moving Average * Moving Average && Volumes[barshift_D1[i]] > Volumes[1+barshift_D1[i]] * DAILY_VOLUME_MULTIPLIER //Volumes > Volumes * fixed value && Volumes2[barshift_H1[i]] > Volumes2[1+barshift_H1[i]] / HOURLY_VOLUMEMULTIPLIER //Volumes > Volumes / fixed value ) { Buffer2[i] = High[i] - ATR[i]; //Set indicator value at Candlestick High - Average True Range if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Sell"); time_alert = Time[0]; } //Instant alert, only once per bar } else { Buffer2[i] = EMPTY_VALUE; } }return(rates_total);
}
//+------------------------------------------------------------------+ -
PLS NOTE THAT I USED FOR SEVERAL YEARS THIS WAY TO CREATE INDICATORS BUT I DO NOT SUCCEED TO MAKE IT WORK TO CREATE EA IN FX DREEMA...SURE OF YOUR UNDERSTANDING...
-
@bacharchoura1
Just use it as custom indicator