حل المطلوب السابق يكون كالتالي
1 الحل باستخدام كتابة علي الشارت فقط
[PHP]
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++)
{
//من اجل الشمعة 1
double spread1=iHigh(0,0,i+1)-iLow(0,0,i+1);
//من اجل الشمعة 2
double spread2=iHigh(0,0,i+2)-iLow(0,0,i+2);
// نقارن هنا بين حجم الشمعتين
if(spread1>spread2)
Comment(" bar1 > bar2");
else if(spread1<spread2)
Comment(" bar1 < bar2");
else
Comment("bar1 = bar2");
}
return(0);
}
[/PHP]