الان نجمع اكواد الكائنات الرسومية مع الحلقة التكرارية سيكون لدينا التالي
[PHP]
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Yellow
#property indicator_color4 Lime
double CrossUp1[];
double CrossDown1[];
double FastMA[];
double SlowMA[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 234);
SetIndexBuffer(0, CrossDown1);
SetIndexStyle(1, DRAW_ARROW, EMPTY);
SetIndexArrow(1, 233);
SetIndexBuffer(1, CrossUp1);
SetIndexStyle( 2, DRAW_LINE );
SetIndexBuffer( 2, FastMA );
SetIndexStyle( 3, DRAW_LINE );
SetIndexBuffer(3, SlowMA );
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int x,i;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
x=Bars-counted_bars;
for(i =0 ; i<x ; i++)
{
}
return(0);
}
[/PHP]