//+------------------------------------------------------------------+ //|TD Channel 1 //|Copyright ゥ 2006, senseki //| //+------------------------------------------------------------------+ #property copyright "Copyright ゥ 2006, Senseki" #property link "none" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Black #property indicator_color2 Black //パラメーター設定 extern double MA_Period=3; extern double MA_Shift=0; extern int MAType=0; extern double up_line=1.03; extern double down_line=0.97; //---- インディケータバッファ double Buf0[]; double Buf1[]; //---- variables int MAMode; string strMAType; //+------------------------------------------------------------------+ //| インディケータ初期化関数 | //+------------------------------------------------------------------+ int init() { //---- バッファのインディケータへの割り当て SetIndexBuffer(0, Buf0); SetIndexBuffer(1, Buf1); //---- インディケータの種類の設定 SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1); switch (MAType) { case 0: strMAType="SMA"; MAMode=MODE_SMA; break; case 1: strMAType="EMA"; MAMode=MODE_EMA; break; case 2: strMAType="SMMA"; MAMode=MODE_SMMA; break; case 3: strMAType="LWMA"; MAMode=MODE_LWMA; break; } return(0); } //+------------------------------------------------------------------+ //| インディケータ処理関数 | //+------------------------------------------------------------------+ int start() { int limit=Bars-IndicatorCounted(); for(int i=limit-1; i>=0; i--) { // 上部チャネル Buf0[i] = iMA(NULL,0,MA_Period,MA_Shift,MAMode,PRICE_LOW,i)*(up_line); // 下部チャネル Buf1[i] = iMA(NULL,0,MA_Period,MA_Shift,MAMode,PRICE_HIGH,i)*(down_line); } return(0); } //+------------------------------------------------------------------+