質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
MQL4

MQL4とは、MT4(MetaTrader4)で用いられるプログラム言語です。MT4は無料で使えるチャートソフトあり、MQL4を使うことで分析ツールのオリジナルスクリプトの作成ができます。

Q&A

0回答

525閲覧

mql4コンパイルエラーの修正

PonMaru

総合スコア8

MQL4

MQL4とは、MT4(MetaTrader4)で用いられるプログラム言語です。MT4は無料で使えるチャートソフトあり、MQL4を使うことで分析ツールのオリジナルスクリプトの作成ができます。

0グッド

0クリップ

投稿2023/03/20 15:16

実現したいこと

コンパイルエラーの修正をお願いします。

前提

ここに質問の内容を詳しく書いてください。
mql4でサインインジケーターを作成してるのですが
コンパイルエラーで困ってます。

発生している問題・エラーメッセージ

'iCCI' - wrong parameters count
'iRSI' - wrong parameters count
'iCCI' - wrong parameters count
'iRSI' - wrong parameters count
not all control paths return a value

該当のソースコード

//---- property
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Aqua

//---- input parameters
extern int CCIPeriod = 14;
extern int RSIPeriod = 14;
extern bool Alerts =true;

//---- indicator buffers
double BuyArrow[];
double SellArrow[];

//---- indicator parameters
int CCI_Handle;
int RSI_Handle;

//---- initialization function
int init()
{
//---- indicators
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW,1);
SetIndexArrow(0,233);
SetIndexBuffer(0,BuyArrow);
SetIndexStyle(1,DRAW_ARROW,1);
SetIndexArrow(1,234);
SetIndexBuffer(1,SellArrow);

//---- indicator handles
CCI_Handle = iCCI(NULL,0,CCIPeriod,PRICE_CLOSE,1); // get the handle of CCI indicator with the specified period
RSI_Handle = iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,1); // get the handle of RSI indicator with the specified period

//----

}

//---- deinitialization function
int deinit()
{
//----

//----
return(0);
}

//---- calculation function
int start()
{
int limit;
int counted_bars=IndicatorCounted();

//---- check for possible errors
if(counted_bars<0) return(-1);

//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

//---- main loop
for(int i=0; i<limit; i++)
{
double cci = iCCI(CCI_Handle,i); // get the value of CCI at the current bar using the handle
double rsi = iRSI(RSI_Handle,i); // get the value of RSI at the current bar using the handle

double cci_prev = iCCI(CCI_Handle,i+1); // get the value of CCI at the previous bar using the handle double rsi_prev = iRSI(RSI_Handle,i+1); // get the value of RSI at the previous bar using the handle //---- check for buy signal if(cci<90 && cci_prev>90 && rsi<85 && rsi_prev>85) { BuyArrow[i] = Low[i]-10*Point; // draw buy arrow below low price if(Alerts) Alert("Buy signal at bar ",i); // send alert message } //---- check for sell signal if(cci>-90 && cci_prev<-90 && rsi>15 && rsi_prev<15) { SellArrow[i] = High[i]+10*Point; // draw sell arrow above high price if(Alerts) Alert("Sell signal at bar ",i); // send alert message } }

}

試したこと

コンパイルエラーがなくなったとしてこのコードで矢印とアラートが動作するでしょうか?

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

archiver

2023/03/21 03:19

まあ、一つずつ見ていきましょうか。 "wrong parameters count"と言っているので、iCCIとiRSIのそれぞれの関数のパラメータ数が合っていないということです。start関数で使っているiCCIとiRSIのパラメータが関数仕様通りではないですね。ここで使うiCCIとiRSIは使おうとしているものです?
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問