 |
 |
|
 |
|
انا عملت المؤشر كدا
كود:
//+------------------------------------------------------------------+
//| mmma caaal.mq4 |
//| ahmed saleh |
//| facebook |
//+------------------------------------------------------------------+
#property copyright "ahmed saleh"
#property link "facebook"
#property indicator_chart_window
int maperiod =20;
int mashift =0;
int mamethod =0;
int appliedpriceto =0;
double mm ;
double MaCal[];
double auto_period;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
int period = Period();
auto_period=maperiod*mm;
switch(period)
{
case 5: mm=12 ;break;
case 15: mm=4 ;break;
case 30: mm=2 ;break;
case 60: mm=1 ;break;
case 240:mm=0.25 ;break;
}
SetIndexBuffer(0,MaCal);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red);
SetIndexDrawBegin(0,auto_period);
SetIndexLabel(0,"auto ma");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int counted_bars=IndicatorCounted();
if (counted_bars<0)
return(-1);
if (counted_bars>0)
counted_bars--;
int uncounted_bars = Bars-counted_bars;
for(int i=0;i<uncounted_bars;i++)
{
MaCal[i]= iMA(NULL,0,auto_period,mashift,mamethod,appliedpriceto,i);
}
//----
return(0);
}
//+------------------------------------------------------------------+
الحمد لله لما بضغط compile مبلاقيش اخطاء .. بس لما بحطو على الشارت مبيشتغلش

.. اتمنى يكون عندك الحل .. شكرا |
|
 |
|
 |
،،،الكود مظبوط لكن ينقصه اضافة السطرين التاليين الى اول الكود،،،
كود:
#property indicator_buffers 1
#property indicator_color1 Red