
コードを作っては改造して無くしてしまうのでWEB上に保存しておきます。
RSIにフラクタルを表示させるインジケーターです。
RSIをフラクタル表示させることで点をトレンドラインで結びやすくなりますので、RSIで6億円稼いだGFF氏の手法を利用することも可能です。
シンプルなテクニカル手法としてご利用下さい。
MQLプログラムコードとダウンロードリンクを設置しておきます。
//+------------------------------------------------------------------+ //| RSIFractals.mq4 | //| Copyright 2019, Greeds Inc. | //| https://greeds.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, Greeds Inc." #property link "https://greeds.net" #property version "1.00" #property strict #property indicator_separate_window #property indicator_level1 80 #property indicator_level2 70 #property indicator_level3 50 #property indicator_level4 30 #property indicator_level5 20 #property indicator_buffers 3 #property indicator_color1 Gold #property indicator_color2 Red #property indicator_color3 Blue //buffer double BufRSI[]; double BufUpper[]; double BufLower[]; input int Period=14; input int loopCount=100; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { SetIndexBuffer(0,BufRSI); SetIndexStyle(0,DRAW_LINE,0,1); SetIndexLabel(0,"RSI"); SetIndexBuffer(1,BufUpper); SetIndexStyle(1,DRAW_ARROW,0,1); SetIndexLabel(1,"Upper"); SetIndexBuffer(2,BufLower); SetIndexStyle(2,DRAW_ARROW,0,1); SetIndexLabel(2,"Lower"); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int changed = changedBars(rates_total, prev_calculated); for(int i=0;i<MathMin(loopCount,ArraySize(Time));i++) { BufRSI[i]=RSI(i); if(RSI(i)>RSI(i+1) && RSI(i)>RSI(i+2) && RSI(i)>RSI(i-1) && RSI(i)>RSI(i-2)) BufUpper[i]= RSI(i); if(RSI(i)<RSI(i+1) && RSI(i)<RSI(i+2) && RSI(i)<RSI(i-1) && RSI(i)<RSI(i-2)) BufLower[i]= RSI(i); } return(rates_total); } //+------------------------------------------------------------------+ int changedBars(int rates_total, int prev_calculated) { if (prev_calculated==0)return rates_total; return rates_total - prev_calculated + 1; } double RSI(int index) { return iRSI(NULL,0,Period,PRICE_CLOSE,index); }
[wpdm_package id=’10862′]