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...
Posts made by bacharchoura1
-
RE: HOW TO USE MOVING AVARAGE OF ACCUMLATION DISTRIBUTION ?posted in Questions & Answers
-
RE: HOW TO USE MOVING AVARAGE OF ACCUMLATION DISTRIBUTION ?posted in Questions & Answers
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);
}
//+------------------------------------------------------------------+ -
HOW TO USE MOVING AVARAGE OF ACCUMLATION DISTRIBUTION ?posted in Questions & Answers
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 -
HOW TO MAKE AUTO RESTART ?posted in Questions & Answers
GOOD DAY
https://fxdreema.com/shared/GGtvesizeWITH THE ABOVE STRUCTURE THE EA WILL CLOSE ALL OPEN TRADES TERMINATE ITSELF UNTILL IT RESTARTED..
THE QUESTION IS: HOW TO MAKE THE EA AUTOMATICALLY STARTS AGAIN AT A SPECIFIC TIME ? FOR EAMBLE AFTER 4 HOURS ?
HOPE YOU CAN HELP ME WITH THIS , TKS
RGDS -
RE: running 3 pairs on the same chart and same EA..!!!posted in Questions & Answers
MR JSTAP: I JUST WANT TO SAY : YOU ARE GREATE ...... THANK YOU
-
running 3 pairs on the same chart and same EA..!!!posted in Questions & Answers
how can i run an EA on ONE chart (for examble eurusd) but it must open trades on 3 pairs simultinuosly ( for examble eurusd, eurpjpy, eurusd).
the reason of this is to succeed to make the optimization for the EA when in runs on 3 pairs together on the same account so we can choose the best pairs with the right corralition between them ???hope you can help with this..
rgds -
HOW TO TO PUT THE NET POSITIVE VOLUME IN A VARIABLE AND SHOW IT AS A COMMENT ?posted in Questions & Answers
GOOD DAY
I AM OPENING SEVERAL BUY AND SELL POSITIONS ON THE SAME PAIR AND WITH DIFFERENT TRADES SIZES.
ONLY IF THE TOTAL BUY TRADES VOLUME IN BIGGER THAN THE SELL TRADES VOLUME , IN THIS CASE I MEED TO PUT THE POSITIVE DIFFERENCE IN A VARIABLE (TOTAL BUY VOLUME – TOTAL SELL VOLUME)
AND
ONLY IF THE TOTAL SELL TRADES VOLUME IN BIGGER THAN THE BUY TRADES VOLUME , IN THIS CASE I MEED TO PUT THE POSITIVE DIFFERENCE IN A VARIABLE (TOTAL SELL VOLUME –TOTAL BUY VOLUME)
IN THE BELOW STRUCTION I SUCCEEDED TO DO BUT IT PUTS THE “POSITIVE VOLUME” ALWAYS ( EVEN IF THE BUY TRADES VOLUMES IS LESS THAN THE SELL TRADES VOLUMES AND EVEN IF THE SELL TRADES VOLUME IS LESS THAN THE BUT TRADES VOLUME)
https://fxdreema.com/shared/oq8vJyJDbHOPE YOU CAN HELP ME TO FIX , TKS.
RGDS -
RE: HOW TO PUT THE NET BUY AND NET SELL VOLUMES IN TWO SEPARATE VARIABLES?posted in Questions & Answers
MR JSTAP , IT SEAMS STRANGE THAT IN YOUR STRUCTURE https://fxdreema.com/shared/nterG2vPd , THAT FOR SELLS PROFITS YOU ARE PUTTING THE SUM OF BUYS + PROFIS BUY IN "SELL" VARIABLE WHILE FOR "BUY" PROFITS YOU ARE PUTTING THE "SELLS" + "SELLS" PROFITS IN "SELL" VARIABL...!!!
SIMPLY SEE THE SCREEN SHOT ...PLS DOUBLE CHECK AND CONFIRM IF IT IS CORRECT LIKE THAT OR EVENTUALY RECTIFY..., TKS
RGDS
-
RE: HOW TO PUT THE NET BUY AND NET SELL VOLUMES IN TWO SEPARATE VARIABLES?posted in Questions & Answers
THANK YOU JSTAP FOR YOUR PROMPT REPLAY..
BUT PLS NOTE THAT I AM SPEAKING ABOUT "VOLUMES" = TRADE SIZES WHILE THIS (https://fxdreema.com/shared/nterG2vPd) SPEAKING ABOUT "PROFITS"...
HOW CAN DO THE SAME FOR "TRADE SIZE" PLEASE ?
IS IT ENOUGH TO CHANGE THE PINK IN THE FORMULA TO "VOLUME" INSTEAD OF "PROFIT"...??
SECONDLY , DO I NEED TO REST THE VARIABLES TO ZERO OR IT IS ALREADY INCLUDID IN YOUR STRUCTURE ?
THANK YOU -
HOW TO PUT THE NET BUY AND NET SELL VOLUMES IN TWO SEPARATE VARIABLES?posted in Questions & Answers
HOPE YOU CAN HELP ME WITH THIS:
I AM HAVING AT THE SAME TIME SEVERAL "OPEN BUY" AND SEVERAL "OPEN SELL" POSITIONS WITH DIFFERENT VOLUMES (TRADE SIZES), AND ALL ON THE SAME PAIR .
I NEED TO PUT THE TOTAL AMOUNT OF OPEN BUY TRADES IN A VARIABLE AND TOTAL AMOUNT OF OPEN SELL TRADES IN ANOTHER VARIABLE AND FINALLY PUT THE NET OPEN AMOUNT IN A THIRD VARIABLE...
HOPE YOU CAN HELP ME WITH THIS, TKS
RGDS -
how to put open profit buy and open profit sell in variables?posted in Questions & Answers
good day
having several buy positions and several sell positions att he same time and same pair , how can i put the open profit for the "buy" open trades and the "sell" open trades in two separate variables ??
tks -
how to store the last opened trade size in a variable ?posted in Questions & Answers
good day
kindly tell me how to save the LAST OPENED "buy" trade size in a variable and how to store the LAST OPENED "sell" trade size in a different variable so that i can use these 2 variables to determine the size of the next buy or sell position...
thank you -
WHAT IS "WAIT TO PASS" USED FOR ?posted in Questions & Answers
GOOD DAY
https://fxdreema.com/shared/3MOr1DUEc
THIS IS THE LINK OF MY PROJECT , WHEN I RIGHT CLICK AND CHOOS "WAIT TO PASS" THE BLOCK BORDER COLORE CHANGE INTO BLUE,THE QUESTION IS : WHAT IS THE "WAIT T PASS" USED FOR ???
RGDS -
RE: HOW TO SET NEW BUY TRADE SIZE EQUAL TO THE TOTAL CURRENT OPENED BUY SIZE???posted in Questions & Answers
THANK YOU MR JSTAP FOR YOUR ABOVE REPLAY..
TO ACHIVE THE SAME RESULT I DID THIS : https://fxdreema.com/shared/dPUcraSQdKINLDY TELL ME THE DIFFERENCE BETWEEN YOUR PROPOSAL AND WHAT I DID... TKS.
RGDS -
HOW TO SET NEW BUY TRADE SIZE EQUAL TO THE TOTAL CURRENT OPENED BUY SIZE???posted in Questions & Answers
GOOD DAY
THIS IS THE LINK OF MY PROJECT:
https://fxdreema.com/shared/0yvWbX65
I AM OPENING RANDUM BUY AND SELL POSITIONS AT THE SAME TIME , THEN WHEN THE PRICE MOVE IN ONE DIRECTION THE EA MUST OPEN MORE AND MORE TRADES IN THE DIRECTION OF THE WINNING TRADE , EACH NEW TRADE MUST HAVE A SIZE EQUAL TO 150% THE TOTAL OPENED TRADE SIZE IN THE SAME DIRECTION..., I MADE THE ABOVE PROJECT BUT IT OPENS TRADES WITH STRANGE AND CONFUSED TRADES SIZES...
KINDLY HELP TELLING ME HOW TO FIX IT , TKS. -
HOW TO CHEK THE DFFERENE BETWEEN TOTAL OPEN PROFIT BUY AND DIFFERENT OPEN PROFIT LOSS?posted in Questions & Answers
GOOD DAY
HOPE YOU CAN HELP ME WITH THIS:
WHEN I HAVE SEVERAL BUY POSITIONS AND SEVERAL SELL POSITIONS AND CONTINUE TO OPEN MORE AND MORE BUY AND SELL POSITIONS, PLS, HOW CAN I PUT THE TOTAL OPEN BUY POSITIONS "PROFITS" , AND TOTAL SELL POSITIONS "PROFIT" IN 2 SEPARATE VARIABLES (NOTICING THAT THEY MUST BE UPDATED EACH TIME MARKET PRICE CHANGE ) ,SO THAT I CAN USE THESE 2 VARIABLES IN MY EA?
THANK YOU FOR YOUR HELP... -
RE: how set stop lose at the opening price of the previous position?posted in Questions & Answers
good morning ,hope you can replay telling me as detailed as possible, tks
-
RE: how set stop lose at the opening price of the previous position?posted in Questions & Answers
Dear Mr l’andorra
The only missed part is the exit part , below is the complete project:
1- Open a first buy and first sell trade on the EA start.
2- If the first trade (buy or sell) go in profit for the variable (and optimizable ) amount of “DELTAFF” in dollar ; then the EA must open the 2nd trade in the same direction of the wining trade and put a stop lose at the opening price of the first trade…
And so on… the EA must continue opening a next trade in the same direction of the previous winning trade and put the previous wining trade open price as a stop loss for the next one.
3- Exit :
-the EA must close all buy trades if the stop loss of the last open BUY trade is triggered
And
-the EA must close all sell trades if the stop loss of the last opened SELL trade is triggered
PLS HELP, TKS -
RE: WHAT IS THE DIFFERENCE BETWEEN : CUSTOM (PRICE LEVEL) AND CUSTOM (PRICE FRACTION)posted in Questions & Answers
sir , you say " distance of 2 of these levels" ....
please : which levels ? pls try to write few more words to explain...tks