//+------------------------------------------------------------------+ //| Sample5_Ind.mq4 | //| Copyright ゥ 2006, Toyolab FX | //| http://forex.toyolab.com | //+------------------------------------------------------------------+ #property copyright "Copyright ゥ 2006, Toyolab FX" #property link "http://forex.toyolab.com" #property indicator_separate_window #property indicator_buffers 1 #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_level1 20 #property indicator_level2 80 //---- パラメータ extern int ST_Period=14; //---- インディケータバッファ double Buf0[]; //+------------------------------------------------------------------+ //| インディケータ初期化関数 | //+------------------------------------------------------------------+ int init() { //---- バッファのインディケータへの割り当て SetIndexBuffer(0, Buf0); //---- インディケータの種類の設定 SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1, Blue); //---- インディケータの表示開始位置の設定 SetIndexDrawBegin(0, ST_Period); return(0); } //+------------------------------------------------------------------+ //| インディケータ処理関数 | //+------------------------------------------------------------------+ int start() { int limit=Bars-IndicatorCounted(); for(int i=limit-1; i>=0; i--) { double HH=0, LL=10000; for(int j=0; j HH) HH = High[i+j]; if(Low[i+j] < LL) LL = Low[i+j]; } Buf0[i] = (Close[i]-LL) / (HH-LL) * 100; } return(0); } //+------------------------------------------------------------------+