実現したいこと
コンパイルエラーを直したい。
前提
MQL5のコンパイルの時にエラーが出ました。
発生している問題・エラーメッセージ
OnCalculate function not found in custom indicator
'SetIndexBuffer' - ambiguous call to overloaded function with the same parameters
could be one of 2 function(s)
built-in: bool SetIndexBuffer(int,double&[],ENUM_INDEXBUFFER_TYPE)
bool SetIndexBuffer(int,double&[])
'SetIndexBuffer' - ambiguous call to overloaded function with the same parameters
could be one of 2 function(s)
built-in: bool SetIndexBuffer(int,double&[],ENUM_INDEXBUFFER_TYPE)
bool SetIndexBuffer(int,double&[])
該当のソースコード
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 Red
double G_ibuf_76[];
double G_ibuf_80[];
input int FasterEMA = 14;
input int SlowerEMA = 21;
input int RSIPeriod = 16;
input bool Alerts = false;
input bool PlaySound = true;
bool Gi_100 = false;
bool Gi_104 = false;
bool Gi_108 = false;
bool Gi_112 = false;
int Gi_116 = 0;
bool Gi_120 = false;
bool Gi_124 = false;
// E37F0136AA3FFAF149B351F6A4C948E9
int OnInit() {
SetIndexStyle(0, DRAW_ARROW, EMPTY, 1);
SetIndexArrow(0, 233);
SetIndexBuffer(0, G_ibuf_76);
SetIndexStyle(1, DRAW_ARROW, EMPTY, 1);
SetIndexArrow(1, 234);
SetIndexBuffer(1, G_ibuf_80);
return (0);
}
// 52D46093050F38C27267BCE42543EF60
int deinit() {
return (0);
}
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
int Li_8;
double ima_12;
double ima_20;
double ima_28;
double ima_36;
double ima_44;
double ima_52;
double irsi_60;
double irsi_68;
double irsi_76;
double Ld_84;
double Ld_92;
int Li_100 = 0;
if (Li_100 < 0) return (-1);
if (Li_100 > 0) Li_100--;
int Li_0 = Bars - Li_100;
for (int Li_4 = 0; Li_4 < Li_0; Li_4++) {
Li_8 = Li_4;
Ld_84 = 0;
Ld_92 = 0;
for (Li_8 = Li_4; Li_8 <= Li_4 + 9; Li_8++) { if (Li_8 < Bars) { Ld_92 += MathAbs(High[Li_8] - Low[Li_8]); } }
Ld_84 = Ld_92 / 10.0;
ima_12 = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4);
ima_28 = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4 + 1);
ima_44 = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4 - 1);
ima_20 = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4);
ima_36 = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4 + 1);
ima_52 = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_CLOSE, Li_4 - 1);
irsi_60 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, Li_4);
irsi_68 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, Li_4 + 1);
irsi_76 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, Li_4 - 1);
if (irsi_60 > 50.0 && irsi_68 < 50.0 && irsi_76 > 50.0) {
Gi_104 = true;
Gi_112 = false;
}
if (irsi_60 < 50.0 && irsi_68 > 50.0 && irsi_76 < 50.0) {
Gi_104 = false;
Gi_112 = true;
}
if (ima_12 > ima_20 && ima_28 < ima_36 && ima_44 > ima_52) {
Gi_100 = true;
Gi_108 = false;
}
if (ima_12 < ima_20 && ima_28 > ima_36 && ima_44 < ima_52) {
Gi_100 = false;
Gi_108 = true;
}
if (Gi_100 == true && Gi_104 == true && Gi_116 != 1) {
G_ibuf_76[Li_4] = Low[Li_4] - 0.8 * Ld_84;
if (Li_4 <= 2 && Alerts && (!Gi_120)) {
Alert(Symbol(), " ", Period(), " Signal:BUY! ");
PlaySound(StringSubstr(Symbol(),0,6)+".wav");
Gi_120 = true;
Gi_124 = false;
}
Gi_116 = 1;
} else {
if (Gi_108 == true && Gi_112 == true && Gi_116 != 2) {
G_ibuf_80[Li_4] = High[Li_4] + 0.8 * Ld_84;
if (Li_4 <= 2 && Alerts && (!Gi_124)) {
Alert(Symbol(), " ", Period(), " Signal:SEL! ");
PlaySound(StringSubstr(Symbol(),0,6)+".wav");
Gi_124 = true;
Gi_120 = false;
}
Gi_116 = 2;
}
}
RefreshRates();
}
return (0);
}
//+------------------------------------------------------------------+
//| Copyright 2018 YutakaYokouchi |
//| https://www.mql5.com/en/users/abundant |
//+------------------------------------------------------------------+
//| Functions for migration |
//+------------------------------------------------------------------+
double Ask=0;
int Bars=0;
double Bid=0;
int Digits=0;
double Point=0;
double Close[];
double High[];
double Low[];
double Open[];
datetime Time[];
long Volume[];
void BRiCK()
{
Ask=SymbolInfoDouble(_Symbol,SYMBOL_ASK);
Bars=Bars(_Symbol, _Period);
Bid=SymbolInfoDouble(_Symbol,SYMBOL_BID);
Digits=(int)SymbolInfoInteger(_Symbol,SYMBOL_DIGITS);
Point=SymbolInfoDouble(_Symbol,SYMBOL_POINT);
ArraySetAsSeries(Close, true);
ArraySetAsSeries(High, true);
ArraySetAsSeries(Low, true);
ArraySetAsSeries(Open, true);
ArraySetAsSeries(Time, true);
ArraySetAsSeries(Volume, true);
int count = Bars(_Symbol, _Period);
ArrayResize(Close, count);
ArrayResize(High, count);
ArrayResize(Low, count);
ArrayResize(Open, count);
ArrayResize(Time, count);
ArrayResize(Volume, count);
CopyClose(_Symbol, _Period, 0, Bars, Close);
CopyHigh(_Symbol, _Period, 0, Bars, High);
CopyLow(_Symbol, _Period, 0, Bars, Low);
CopyOpen(_Symbol, _Period, 0, Bars, Open);
CopyTime(_Symbol, _Period, 0, Bars, Time);
CopyTickVolume(_Symbol, _Period, 0, Bars, Volume);
ProductBRiCK();
}
void ProductBRiCK()
{
string obj_name="BRiCK_Convert4To5_Free";
int chart_id=0;
if(ObjectFind(chart_id,obj_name)<0){
string text="Powered by BRiCK";
ObjectCreate(chart_id,obj_name,OBJ_LABEL,0,0,0);
ObjectSetInteger(chart_id,obj_name,OBJPROP_ANCHOR,ANCHOR_LEFT_LOWER);
ObjectSetInteger(chart_id,obj_name,OBJPROP_CORNER,CORNER_LEFT_LOWER);
ObjectSetString(chart_id,obj_name,OBJPROP_TEXT,text);
ObjectSetInteger(chart_id,obj_name,OBJPROP_COLOR,clrDarkOrange);
ObjectSetInteger(chart_id,obj_name,OBJPROP_BACK,false);
ObjectSetInteger(chart_id,obj_name,OBJPROP_SELECTABLE,true);
ObjectSetInteger(chart_id,obj_name,OBJPROP_SELECTED,false);
ObjectSetInteger(chart_id,obj_name,OBJPROP_HIDDEN,true);
ObjectSetInteger(chart_id,obj_name,OBJPROP_FONTSIZE,24);
ObjectSetInteger(chart_id,obj_name,OBJPROP_XDISTANCE,0);
ObjectSetInteger(chart_id,obj_name,OBJPROP_YDISTANCE,0);
Print(obj_name+"[Info] "+text);
}
}
void SetIndexArrow(int index, int code)
{
PlotIndexSetInteger(index, PLOT_ARROW, code);
}
void SetIndexStyle(int index, int type, int style=EMPTY, int width=EMPTY, color clr=clrNONE)
{
if(width > -1){
PlotIndexSetInteger(index, PLOT_LINE_WIDTH, width);
}
PlotIndexSetInteger(index, PLOT_LINE_COLOR, clr);
switch(type){
case 1:
PlotIndexSetInteger(index, PLOT_DRAW_TYPE, DRAW_SECTION);
break;
case 2:
PlotIndexSetInteger(index, PLOT_DRAW_TYPE, DRAW_HISTOGRAM);
break;
case 3:
PlotIndexSetInteger(index, PLOT_DRAW_TYPE, DRAW_ARROW);
break;
case 4:
PlotIndexSetInteger(index, PLOT_DRAW_TYPE, DRAW_ZIGZAG);
break;
case 12:
PlotIndexSetInteger(index, PLOT_DRAW_TYPE, DRAW_NONE);
break;
default:
PlotIndexSetInteger(index, PLOT_DRAW_TYPE, DRAW_LINE);
break;
}
if(style == EMPTY){
return;
}
switch(style){
case 0:
PlotIndexSetInteger(index, PLOT_LINE_STYLE, STYLE_SOLID);
break;
case 1:
PlotIndexSetInteger(index, PLOT_LINE_STYLE, STYLE_DASH);
break;
case 2:
PlotIndexSetInteger(index, PLOT_LINE_STYLE, STYLE_DOT);
break;
case 3:
PlotIndexSetInteger(index, PLOT_LINE_STYLE, STYLE_DASHDOT);
break;
case 4:
PlotIndexSetInteger(index, PLOT_LINE_STYLE, STYLE_DASHDOTDOT);
break;
}
}
bool SetIndexBuffer(int index, double &buffer[])
{
return(SetIndexBuffer(index, buffer, INDICATOR_DATA));
}
bool ObjectCreate(string object_name, int object_type, int sub_window, datetime time1, double price1, datetime time2=0, double price2=0, datetime time3=0, double price3=0)
{
![guest](/img/icon/icnUserSample.jpg)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。