//+------------------------------------------------------------------+ //| Sample8_Ind.mq4 | //| Copyright ゥ 2006, Toyolab FX | //| http://forex.toyolab.com | //+------------------------------------------------------------------+ #property copyright "Copyright ゥ 2006, Toyolab FX" #property link "http://forex.toyolab.com" #property indicator_chart_window #property indicator_buffers 2 //---- インディケータバッファ double Buf0[]; double Buf1[]; //+------------------------------------------------------------------+ //| インディケータ初期化関数 | //+------------------------------------------------------------------+ int init() { //---- バッファのインディケータへの割り当て SetIndexBuffer(0, Buf0); SetIndexBuffer(1, Buf1); //---- インディケータの種類の設定 SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1, Red); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1, Blue); return(0); } //+------------------------------------------------------------------+ //| インディケータ処理関数 | //+------------------------------------------------------------------+ int start() { int limit=Bars-IndicatorCounted(); for(int i=limit-1; i>=0; i--) { Buf0[i] = iMA(NULL,0,5,0,MODE_SMMA,PRICE_CLOSE,i); //5日SMA Buf1[i] = iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,i); //5日EMA } return(0); } //+------------------------------------------------------------------+