3DMa Indicator For MT4
3DMa Indicator For MT4の3DMa Indicator For MT4は、トレンド市場内の移動平均を3次元形式で表示するため、移動平均取引システムに新しいダイナミックを追加するインジケータです。これは、3次元形式の移動平均であるだけでなく、ヒートマップに似た虹色のスキームを持っているため、取引分析を新しい次元に導きます。このカラーマップを使用すると、市場のセンチメントとトレンドの反転を明確に検出できます。さらに、マウスを使用して移動平均の期間などのパラメーターを変更できます(複雑なことは何もありません)。
3DMa Indicator For MT4インストール
上記のフォームからインジケーターをダウンロードした後、zipファイルを解凍する必要があります。次に、ファイル3DMa.mq4をMT4インストールのMQL4Indicatorsフォルダーにコピーする必要があります。その後、MT4を再起動してください。そうすると、インジケーターのリストにインジケーターが表示されます。
3DMa Indicator For MT4パラメーター
3DMa Indicator For MT4は、構成する0 パラメーターがあります。
3DMa Indicator For MT4
3DMa Indicator For MT4は、 0 バッファーを提供します。
コードの主要部分
int OnCalculate(const int rates_total,const int prev_calculated,const int begin,const double &price[])
{
return(rates_total);
}
//+------------------------------------------------------------------+
//| ChartEvent function |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
static int MaOld=-1,stepMaOld=-1;
static bool click=true;
static string pre_sparam="1";
static int preMa=0;
if(sparam=="1" && sparam!=pre_sparam) if(click) click=false; else click=true;
if(click)
{
Ma=W.MouseX+100;
if (Ma gt =Size) Ma=Size-1;
stepMa=W.MouseY-15;
if(stepMa lt =0) stepMa=1;
stepMa=1+stepMa/10;
if(stepMa gt Ma) stepMa=Ma-1;
if (Size gt =W.BarsInWind && preMa!=Ma) nMA();
preMa=Ma;
}
if(id==CHARTEVENT_CHART_CHANGE || MaOld!=Ma || stepMaOld!=stepMa)
{
Size=CopyClose(_Symbol,_Period,(int)W.Right_bar,W.BarsInWind+Ma-1,close);
if (Ma gt =Size) Ma=Size-1;
if (Size gt =W.BarsInWind) nMA();
MaOld=Ma; stepMaOld=stepMa;
}
pre_sparam=sparam;
}
//+------------------------------------------------------------------+
void nMA()
{
Canvas.Erase();
double S=0;
double A[];
ArrayResize(A,W.BarsInWind);
for(int i=Size-1;i gt =Size-Ma; i--) S+=close[i];
for(int Per=Ma;Per gt 0;)
{
double s=S;
uint Clr=Grad((double)Per/Ma);
int j=0;
for(int i=Size-1; i gt =0;i--)
{
double Y=s/Per;
j=Size-1-i;
if (j lt W.BarsInWind) A[j]=Y; else break;
if(i-Per gt =0) s=s+close[i-Per]-close[i]; else break;
}
DrawIndicatorLine(A,Clr,Floor(W.Right_bar),j+Floor(W.Right_bar));
for(j=0; j lt stepMa; j++) if(Per gt 0) {S=S-close[Size-Per]; Per--;} else break;
}
Canvas.TextPosY=90;
Canvas.Comm("Max Period MA = "+string(Ma));
Canvas.Comm("Step MA = "+string(stepMa));
Canvas.Update();
}
//+------------------------------------------------------------------+
uint Grad(double p)
{
static uint Col[6]={0xFF0000FF,0xFFFF00FF,0xFFFF0000,0xFFFFFF00,0xFF00FF00,0xFF00FFFF};
if(p gt 0.9999) return Col[5];
if(p lt 0.0001) return Col[0];
p=p*5;
int n=(int)p;
double k=p-n;
argb c1,c2;
c1.clr=Col[n];
c2.clr=Col[n+1];
return ARGB(255,c1.c[2]+uchar(k*(c2.c[2]-c1.c[2])+0.5),
c1.c[1]+uchar(k*(c2.c[1]-c1.c[1])+0.5),
c1.c[0]+uchar(k*(c2.c[0]-c1.c[0])+0.5));
}
//+------------------------------------------------------------------+
void DrawIndicatorLine(double &arr[], uint clr, int barStart=INT_MIN, int barEnd=INT_MAX)
{
if (barStart lt W.Right_bar) barStart=Floor(W.Right_bar);
if (barEnd gt W.Left_bar) barEnd=W.Left_bar;
if (W.Left_bar lt =barStart) return;
int n=barEnd-barStart;
int x=(int)Canvas.X((double)barStart);
int pre_y=Round(Canvas.Y(arr[0]));
Canvas.PixelSet(x,pre_y,clr);
x-=W.dx_pix;
for(int i=1; i lt n; i++, x-=W.dx_pix)
{
int y=Round(Canvas.Y(arr[i]));
if(fabs(y-pre_y) gt 1 || W.dx_pix gt 1) Canvas.Line(x,y,x+W.dx_pix,pre_y,clr);
else Canvas.PixelSet(x,y,clr);
pre_y=y;
}
}