You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
A bit of a paint job on Murray's levels
Good afternoon. Smart guys really need to translate the correlation indicator in MT5
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2
#property indicator_color1 clrDeepSkyBlue
#property indicator_color2 clrDeepSkyBlue
#property indicator_chart_window
double UpBuffer[];
double DnBuffer[];
int OnInit()
{
SetIndexBuffer(0,UpBuffer);
SetIndexBuffer(1,DnBuffer);
PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(0,PLOT_DRAW_TYPE,PLOT_LINE_WIDTH,3); PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE);
PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(1,PLOT_DRAW_TYPE,PLOT_LINE_WIDTH,3);PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE);
return(0);
}
//+------------------------------------------------------------------+
//| 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 i;
for(i=1000;i>0;i--)
{ UpBuffer[i]=1.428; DnBuffer[i]=1.41;
}
return(0);
}
Why aren't the lines drawn?
It should be something like this, believe it or not, it's working.
Downloaded this indicator. When compiling it gave an error on line 228, I couldn't make a picture, so please take my word for it. I want to use the indicator I use on MT5, that's why I am here, I couldn't do it myself. Maybe you can rewrite it for me. Thank you.
Please help.
Tried to rewrite WATL, almost succeeded. Lines are not drawn correctly, it's because of a crooked LWMA calculation. And most importantly, sometimes the graph has such surprises:
A line of dots is sometimes identical to the dots on which WATL is calculated.
Or sometimes I rotate the graph and the points all overlap on the adjacent bar.
Thanks in advance for any help =)
Maybe who has seen this indicator in MQL5 transformations? http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fileinfo&id=67
Hello,
I couldn't do what I wanted.
I have a different mouwing buffer in my head, I have a different pair, than the one I had in my head.
[code]
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_plots 2
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_color1 clrBlue
#property indicator_color2 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID
input int period_1 = 20;
input int period_2 = 100;
input ENUM_MA_METHOD ma_method = MODE_SMA;
input ENUM_APPLIED_PRICE applied_price = PRICE_CLOSE;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
int EMHandle1=0;
int EMHandle2=0;
int EMHandle11=0;
int EMHandle22=0;
MqlParam params[]; // Structure for saving indicator parameters
double ma1[],ma2[],ma3[],ma4[];//temporal buffers
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0, ExtMapBuffer1, INDICATOR_DATA);
SetIndexBuffer(1, ExtMapBuffer2, INDICATOR_DATA);
SetIndexBuffer(2, ma1, INDICATOR_DATA);
SetIndexBuffer(3, ma2, INDICATOR_DATA);
SetIndexBuffer(4, ma3, INDICATOR_DATA);
SetIndexBuffer(5, ma4, INDICATOR_DATA);
PlotIndexSetInteger(0, PLOT_SHIFT, 0);
PlotIndexSetInteger(1, PLOT_SHIFT, 0);
PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);
PlotIndexSetInteger(1,PLOT_LINE_STYLE,STYLE_SOLID);
//---
PlotIndexSetInteger(0,PLOT_LINE_COLOR,clrBlue);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,clrRed);
PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE);
PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE);
IndicatorSetString(INDICATOR_SHORTNAME, "2_2_MA");
//--- set accuracy
IndicatorSetInteger(INDICATOR_DIGITS,4);
//---
ArrayResize(params,4);
params[0].type =TYPE_INT;
params[0].integer_value=period_1;
// Offset
params[1].type =TYPE_INT;
params[1].integer_value=0;
// Calculation method: simple averaging
params[2].type =TYPE_INT;
params[2].integer_value=MODE_SMA;
// type of prices for calculation: closing prices
params[3].type =TYPE_INT;
params[3].integer_value=PRICE_CLOSE;
EMHandle1 = IndicatorCreate(_Symbol, 0, IND_MA, 4, params;)
ArrayResize(params,4);
params[0].type =TYPE_INT;
params[0].integer_value=period_2;
params[1].type =TYPE_INT;
params[1].integer_value=0;
params[2].type =TYPE_INT;
params[2].integer_value=MODE_SMA;
params[3].type =TYPE_INT;
params[3].integer_value=PRICE_CLOSE;
EMHandle2 = IndicatorCreate(_Symbol, 0, IND_MA, 4, params;)
ArrayResize(params,4);
params[0].type =TYPE_INT;
params[0].integer_value=period_1;
params[1].type =TYPE_INT;
params[1].integer_value=0;
params[2].type =TYPE_INT;
params[2].integer_value=MODE_SMA;
params[3].type =TYPE_INT;
params[3].integer_value=PRICE_CLOSE;
EMHandle11 = IndicatorCreate(_Symbol, 0, IND_MA, 4, params;)
ArrayResize(params,4);
params[0].type =TYPE_INT;
params[0].integer_value=period_2;
params[1].type =TYPE_INT;
params[1].integer_value=0;
params[2].type =TYPE_INT;
params[2].integer_value=MODE_SMA;
params[3].type =TYPE_INT;
params[3].integer_value=PRICE_CLOSE;
EMHandle22 = IndicatorCreate(_Symbol, 0, IND_MA, 4, params;)
return(0);
}
int OnCalculate (const int rates_total,// size of array price[];
const int prev_calculated,// number of available bars ;on previous call;
const int begin,// which index in price[] array will start valid data;
const double &price[]) // array, on which the indicator will be calculated;
{
int i;
ArraySetAsSeries(ma1, true);
ArraySetAsSeries(ma2, true);
ArraySetAsSeries(ma3, true);
ArraySetAsSeries(ma4, true);
if(CopyBuffer(EMHandle1, 0, 0, 1, ma1) < 0){Print("CopyBuffer ma1 error =", GetLastError());}
if(CopyBuffer(EMHandle2, 0, 0, 1, ma2) < 0){Print("CopyBuffer ma2 error =", GetLastError());}
if(CopyBuffer(EMHandle11, 0, 0, 1, ma3) < 0){Print("CopyBuffer ma3 error =", GetLastError());}
if(CopyBuffer(EMHandle22, 0, 0, 0, 1, ma4) < 0){Print("CopyBuffer ma4 error =", GetLastError());}
int limit;
//if(prev_calculated<1)
//limit=period_1;
limit=prev_calculated-1;
for( i=0; i<limit; i++)
ExtMapBuffer1[0]=calculated;
ExtMapBuffer2[0]=calculate;
Comment(
"\n=====================",
"\n ma1[0] : ",DoubleToString(ma1[0],5),
"\n ma2[0] : ",DoubleToString(ma2[0],5),
"\n ma3[0] : ",DoubleToString(ma3[0],5),
"\n ma4[0] : ",DoubleToString(ma4[0],5),
"\n ExtMapBuffer1[0] : ",DoubleToString(ExtMapBuffer1[0],4),
"\n ExtMapBuffer2[0] : ",DoubleToString(ExtMapBuffer2[0],4)
);
return(rates_total);
}
void OnDeinit(const int reason)
{
Comment(");
}
[/code]
When 0 instead of i (for a bar) I see the result, when the bar (current = i) shows that I can not find data for the second pair.
The chart of the pair is open, in the Market Window I do not know where I confuse things.
Two different pairs in one indicator - so where is my error?
I try to put 0 and see the result as a comment, but I have not got a line.
To clarify: I put ma1 and ma2 on one pair and ma3 and ma4 on the other pair.
Thank you.