Oshybka v indikatore Ichimoku?

 
Privet,

Paproboval ja podkliu4it' vstrojennyj Ichimoku indikator i kakto polu4ajetsia mnie zna4enija 0 samovo indikatora..

Vot kusok loga:

2006.01.16 04:03:54 IchimokuTrend EURUSD,M30: tenkan_sen:1.2101 kijun_sen:1.2089 chinkou_span:0 senkou_span_a:1.2089 senkou_span_b:1.1977
2006.01.16 04:03:54 IchimokuTrend EURUSD,M30: ChartPeriod:30 Period1:50 Period2:150 Period3:350 barsshift:0
2006.01.16 04:03:54 IchimokuTrend EURUSD,M30: initialized

Moj custom indikator:

//+------------------------------------------------------------------+
//|                                                IchimokuTrend.mq4 |
//|                           Copyright © 2006, Arunas Pranckevicius |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Arunas Pranckevicius"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int       Tenkan=50;
extern int       Kijun=150;
extern int       Senkou=350;
extern int       Shift=0;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];

int IchimokuTrend(int ChartPeriod,int Period1,int Period2,int Period3,int barsshift)
{
double tenkan_sen;
double kijun_sen;
double chinkou_span;
double senkou_span_a;
double senkou_span_b;

tenkan_sen=iIchimoku(Symbol(), ChartPeriod, Period1, Period2, Period3, MODE_TENKANSEN, barsshift+1);
kijun_sen=iIchimoku(Symbol(), ChartPeriod, Period1, Period2, Period3, MODE_KIJUNSEN, barsshift+1);
chinkou_span=iIchimoku(Symbol(), ChartPeriod, Period1, Period2, Period3, MODE_CHINKOUSPAN, barsshift+1);
senkou_span_a=iIchimoku(Symbol(), ChartPeriod, Period1, Period2, Period3, MODE_SENKOUSPANA, barsshift+1);
senkou_span_b=iIchimoku(Symbol(), ChartPeriod, Period1, Period2, Period3, MODE_SENKOUSPANB, barsshift+1);
Print("ChartPeriod:",ChartPeriod," Period1:",Period1," Period2:",Period2," Period3:",Period3," barsshift:",barsshift);
Print("tenkan_sen:",tenkan_sen," kijun_sen:",kijun_sen," chinkou_span:",chinkou_span," senkou_span_a:",senkou_span_a," senkou_span_b:",senkou_span_b);

if (tenkan_sen > senkou_span_b && kijun_sen > senkou_span_b && chinkou_span > senkou_span_b)
// We have strong UP trend
return (1);

if (tenkan_sen < senkou_span_a && kijun_sen < senkou_span_a && chinkou_span < senkou_span_a)
// We have strong DOWN trend
return (2);

//Otherwise we have flat/divers in Ichimoku cloud
return(0);

}

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,241);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(0,242);
   SetIndexBuffer(1,ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//---- 
  int CheckIchimokuTrend;
  CheckIchimokuTrend=IchimokuTrend(Period(),Tenkan,Kijun,Senkou,Shift);
  
  if (CheckIchimokuTrend == 1) ExtMapBuffer1[0]=Open[0];
  if (CheckIchimokuTrend == 2) ExtMapBuffer2[0]=Open[0];
//----
   return(0);
  }
//+------------------------------------------------------------------+



U menia MT4 build 188
Gde oshybka?

 
Posmotrel jes4io v istoriji, ta samaja problema i s Span A i s Span B,
a vot eti kak ja ponimaju ravny 0 nidalzny byt'...

Vot opisanije samovo indikatora:

http://www.investopedia.com/articles/technical/04/072104.asp
 
А Вы учитываете внутренние сдвиги линий Span A и B у Ишимоку?
Линии Span A и B имеют сдвиг в будущее при отрисовке, а в самом буфере они хранятся без сдвига.
Посмотрите на график и выведите простейшим скриптом значения в нескольких точках.
Причина обращения: