株式会社トリロジー(Trilogy Inc.)/ 投資助言・代理業登録業者

RCIのEAでの利用について

Q)
下のRCIをEAに組み込もうとしているのですが、zero divideのエラーが出て使えなくなります。
RCIといiCustomのコードは下の通りです。間違っている箇所があれば教えてください。

iCustom(NULL, 0, “RCI”, 9, PRICE_CLOSE, 1, i);
iCustom(NULL, 0, “RCI”, 22, PRICE_CLOSE, 2, i);

#property copyright “Copyright 2019, MetaQuotes Software Corp.”
#property link “https://www.mql5.com”
#property version “1.00”
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Maroon
#property indicator_color2 Blue
#property indicator_color3 Green
#property indicator_minimum -100
#property indicator_maximum 100
//—- input parameters
extern int tPr1 = 9;
extern int tPr2 = 26;
extern int tPr3 = 52;
//—- buffers
double Buff1[];
double Buff2[];
double Buff3[];
int D0[];
int D1[];
int D2[];
int D3[];
int tPrMax;
double n1,n2,n3;
//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
int i;

//—- indicator lines
SetIndexBuffer(0,Buff1);
SetIndexBuffer(1,Buff2);
SetIndexBuffer(2,Buff3);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
SetIndexLabel(0,”RCI1:”+tPr1);
SetIndexLabel(1,”RCI2:”+tPr2);
SetIndexLabel(2,”RCI3:”+tPr3);
IndicatorShortName(“RCI 3line(“+tPr1+”,”+tPr2+”,”+tPr3+”)”);

//—-
ArrayResize(D1, tPr1);
ArrayResize(D2, tPr2);
ArrayResize(D3, tPr3);

tPrMax=tPr1;
if (tPr2>tPrMax) tPrMax=tPr2;
if (tPr3>tPrMax) tPrMax=tPr3;

ArrayResize(D0, tPrMax);
for(i=0; i0)
limit = Bars – count;

ArrayCopy(D1,D0,0,0,tPr1);
ArrayCopy(D2,D0,0,0,tPr2);
ArrayCopy(D3,D0,0,0,tPr3);

n=limit;
d1=0;
for(i=0; i

A)
下記エラーですが、よく出るエラーです。

バックテストで出たものとして回答しますと、
ヒストリカルデータの不連続が考えられます。

解決方法は、M1からピリオドコンバーターで4H足を作成し、
不連続箇所を目視にて見つけ不連続を開所することです。







コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です