親愛なる皆様へ。
私はBバンドとB幅で動作するEAをプログラムしています、B幅のために私はカスタムEAを追加しました、私はコンパイルするときにエラーカンプスがありません。
しかし、私はそこにカスタムインジケータの 呼び出しでいくつかの問題があることを確信しています。
しかし、カスタムインジケータの呼び出しに問題があるようで、それを修正するためにプログラマーの助けを必要としています。
ありがとうございました。iBand Widhの入力パラメータの順番に注意してください。
BB_Handle=iCustom(NULL,PERIOD_M1,"i-BB-Width",ibands_period,ibands_shift,ideviation,PRICE_CLOSE);
インジケーターの入力順序によると、以下のようになります。
BB_Handle=iCustom(NULL,PERIOD_M1,"i-BB-Width",ibands_period,ideviation,iapplied_price,ibands_shift);
このカスタムインジケータは 必要ありません。
bbandsがあれば、bbandsのエンベロープを減算すればよい。
- 2009.11.23
- Андрей
- www.mql5.com
iBand Widhの入力パラメータの順番にご注意ください。
iBand Widh : インジケーターの入力順序にしたがって入力する必要があります。
カスタムインジケーターを 追加しているのですが、このインジケーターの正しい呼び出し方法を教えてください。
よろしくお願いします。
//+------------------------------------------------------------------+ //| i-BB-Width.mq5 | //| Copyright © 2007, Kim Igor V. aka KimIV. | //| http://www.kimiv.ru/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, Kim Igor V. aka KimIV." #property link "http://www.kimiv.ru/" #property description "The width of the Bollinger Bands" //---- indicator version number #property version "1.00" //---- drawing indicator in a separate window #property indicator_separate_window //---- number of indicator buffers #property indicator_buffers 1 //---- only one plot is used #property indicator_plots 1 //+-----------------------------------+ //| Parameters of indicator drawing | //+-----------------------------------+ //---- drawing the indicator as a line #property indicator_type1 DRAW_LINE //---- blue color is used for the indicator line #property indicator_color1 Blue //---- the indicator line is a continuous curve #property indicator_style1 STYLE_SOLID //---- Indicator line width is equal to 1 #property indicator_width1 2 //---- displaying the indicator label #property indicator_label1 "i-BB-Width" //+-----------------------------------+ //| Declaration of constants | //+-----------------------------------+ #define RESET 0 // the constant for getting the command for the indicator recalculation back to the terminal //+-----------------------------------+ //| Input parameters of the indicator| //+-----------------------------------+ input uint bands_period=20; //smoothing depth input double deviation=2.0; //deviation input ENUM_APPLIED_PRICE applied_price=PRICE_CLOSE; //type of price or handle input int Shift=0; //horizontal shift of the indicator in bars //+-----------------------------------+ //---- declaration of a dynamic array that further // will be used as an indicator buffer double IndBuffer[]; //---- declaration of integer variables for the indicators handles int BB_Handle; //---- declaration of the integer variables for the start of data calculation uint min_rates_total; //+------------------------------------------------------------------+ //| i-BB-Width indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //---- Initialization of variables of the start of data calculation min_rates_total=bands_period; //---- getting handle of the iBearsPower indicator BB_Handle=iBands(NULL,0,int(bands_period),0,deviation,applied_price); if(BB_Handle==INVALID_HANDLE) Print(" Failed to get handle of the iBands indicator"); //---- set dynamic array as an indicator buffer SetIndexBuffer(0,IndBuffer,INDICATOR_DATA); //---- moving the indicator 1 horizontally PlotIndexSetInteger(0,PLOT_SHIFT,Shift); //---- performing the shift of beginning of indicator drawing PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,min_rates_total); //---- setting the indicator values that won't be visible on a chart PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE); //---- indexing elements in the buffer as in timeseries ArraySetAsSeries(IndBuffer,true); //---- initializations of variable for indicator short name string shortname; StringConcatenate(shortname,"i-BB-Width(", bands_period,", ",deviation,", ",EnumToString(applied_price),", ",Shift,")"); //--- creation of the name to be displayed in a separate sub-window and in a pop up help IndicatorSetString(INDICATOR_SHORTNAME,shortname); //---- determination of accuracy of displaying the indicator values IndicatorSetInteger(INDICATOR_DIGITS,0); //---- end of initialization } //+------------------------------------------------------------------+ //| i-BB-Width iteration function | //+------------------------------------------------------------------+ int OnCalculate( const int rates_total, // amount of history in bars at the current tick const int prev_calculated,// amount of history in bars at the previous tick 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[] ) { //---- checking the number of bars to be enough for calculation if(BarsCalculated(BB_Handle)<rates_total || rates_total<int(min_rates_total)) return(RESET); //---- declaration of variables with a floating point double UpBB[],DnBB[]; //---- Declaration of integer variables and getting already calculated bars int limit,bar,to_copy; //--- calculations of the necessary amount of data to be copied and //the "limit" starting index for loop of bars recalculation if(prev_calculated>rates_total || prev_calculated<=0)// checking for the first start of the indicator calculation { limit=int(rates_total-min_rates_total-1); // starting index for calculation of all bars } else limit=rates_total-prev_calculated; // starting index for calculation of new bars to_copy=limit+1; //---- indexing elements in arrays as time series ArraySetAsSeries(UpBB,true); ArraySetAsSeries(DnBB,true); //---- copy newly appeared data into the arrays if(CopyBuffer(BB_Handle,UPPER_BAND,0,to_copy,UpBB)<=0) return(RESET); if(CopyBuffer(BB_Handle,LOWER_BAND,0,to_copy,DnBB)<=0) return(RESET); //---- Main cycle of calculation of the indicator for(bar=limit; bar>=0 && !IsStopped(); bar--) IndBuffer[bar]=(UpBB[bar]-DnBB[bar])/_Point; //---- return(rates_total); } //+------------------------------------------------------------------+
- 2009.11.23
- Андрей
- www.mql5.com
//+------------------------------------------------------------------+ //| i-BB-Width.mq5 | //| Copyright © 2007, Kim Igor V. aka KimIV. | //| http://www.kimiv.ru/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, Kim Igor V. aka KimIV." #property link "http://www.kimiv.ru/" #property description "The width of the Bollinger Bands" //---- indicator version number #property version "1.00" //---- drawing indicator in a separate window #property indicator_separate_window //---- number of indicator buffers #property indicator_buffers 1 //---- only one plot is used #property indicator_plots 1 //+-----------------------------------+ //| Parameters of indicator drawing | //+-----------------------------------+ //---- drawing the indicator as a line #property indicator_type1 DRAW_LINE //---- blue color is used for the indicator line #property indicator_color1 Blue //---- the indicator line is a continuous curve #property indicator_style1 STYLE_SOLID //---- Indicator line width is equal to 1 #property indicator_width1 2 //---- displaying the indicator label #property indicator_label1 "i-BB-Width" //+-----------------------------------+ //| Declaration of constants | //+-----------------------------------+ #define RESET 0 // the constant for getting the command for the indicator recalculation back to the terminal //+-----------------------------------+ //| Input parameters of the indicator| //+-----------------------------------+ input uint bands_period=20; //smoothing depth input double deviation=2.0; //deviation input ENUM_APPLIED_PRICE applied_price=PRICE_CLOSE; //type of price or handle input int Shift=0; //horizontal shift of the indicator in bars //+-----------------------------------+ //---- declaration of a dynamic array that further // will be used as an indicator buffer double IndBuffer[]; //---- declaration of integer variables for the indicators handles int BB_Handle; //---- declaration of the integer variables for the start of data calculation uint min_rates_total; //+------------------------------------------------------------------+ //| i-BB-Width indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //---- Initialization of variables of the start of data calculation min_rates_total=bands_period; //---- getting handle of the iBearsPower indicator BB_Handle=iBands(NULL,0,int(bands_period),0,deviation,applied_price); if(BB_Handle==INVALID_HANDLE) Print(" Failed to get handle of the iBands indicator"); //---- set dynamic array as an indicator buffer SetIndexBuffer(0,IndBuffer,INDICATOR_DATA); //---- moving the indicator 1 horizontally PlotIndexSetInteger(0,PLOT_SHIFT,Shift); //---- performing the shift of beginning of indicator drawing PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,min_rates_total); //---- setting the indicator values that won't be visible on a chart PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE); //---- indexing elements in the buffer as in timeseries ArraySetAsSeries(IndBuffer,true); //---- initializations of variable for indicator short name string shortname; StringConcatenate(shortname,"i-BB-Width(", bands_period,", ",deviation,", ",EnumToString(applied_price),", ",Shift,")"); //--- creation of the name to be displayed in a separate sub-window and in a pop up help IndicatorSetString(INDICATOR_SHORTNAME,shortname); //---- determination of accuracy of displaying the indicator values IndicatorSetInteger(INDICATOR_DIGITS,0); //---- end of initialization } //+------------------------------------------------------------------+ //| i-BB-Width iteration function | //+------------------------------------------------------------------+ int OnCalculate( const int rates_total, // amount of history in bars at the current tick const int prev_calculated,// amount of history in bars at the previous tick 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[] ) { //---- checking the number of bars to be enough for calculation if(BarsCalculated(BB_Handle)<rates_total || rates_total<int(min_rates_total)) return(RESET); //---- declaration of variables with a floating point double UpBB[],DnBB[]; //---- Declaration of integer variables and getting already calculated bars int limit,bar,to_copy; //--- calculations of the necessary amount of data to be copied and //the "limit" starting index for loop of bars recalculation if(prev_calculated>rates_total || prev_calculated<=0)// checking for the first start of the indicator calculation { limit=int(rates_total-min_rates_total-1); // starting index for calculation of all bars } else limit=rates_total-prev_calculated; // starting index for calculation of new bars to_copy=limit+1; //---- indexing elements in arrays as time series ArraySetAsSeries(UpBB,true); ArraySetAsSeries(DnBB,true); //---- copy newly appeared data into the arrays if(CopyBuffer(BB_Handle,UPPER_BAND,0,to_copy,UpBB)<=0) return(RESET); if(CopyBuffer(BB_Handle,LOWER_BAND,0,to_copy,DnBB)<=0) return(RESET); //---- Main cycle of calculation of the indicator for(bar=limit; bar>=0 && !IsStopped(); bar--) IndBuffer[bar]=(UpBB[bar]-DnBB[bar])/_Point; //---- return(rates_total); } //+------------------------------------------------------------------+
先程も申し上げましたが、オーダーに注意する必要があります。入力パラメータがこのような場合
input uint bands_period=20; //smoothing depth input double deviation=2.0; //deviation input ENUM_APPLIED_PRICE applied_price=PRICE_CLOSE; //type of price or handle input int Shift=0; //horizontal shift of the indicator in bar
のように入力したら、同じ注文を書く必要があります。
BB_Handle=iCustom(NULL,PERIOD_M1,"i-BB-Width",bands_period,deviation,applied_price,Shift);
先程も言ったように、オーダーに注意する必要があります。だから、もしこのような入力パラメータ。
のように入力したら、インジケータを呼び出すために、同じ注文を書く必要があります。
アドバイス通りやってみましたが、やはり問題はontick()でバッファをコピーする際、width indicatorは1行しかなく、indiBufferと表示されます。
もし、widthindicatorのコードのように、width indicatorからどのバッファをコピーすればよいのでしょうか?
//---- copy newly appeared data into the arrays if(CopyBuffer(BB_Handle,UPPER_BAND,0,to_copy,UpBB)<=0) return(RESET); if(CopyBuffer(BB_Handle,LOWER_BAND,0,to_copy,DnBB)<=0) return(RESET);
もし、widthindicatorのコードのようなものであれば、width indicatorからどのバッファをコピーすればよいのでしょうか?
丸2日以上試しましたが、正しい方法でプログラムするようアドバイスください。
どうかよろしくお願いします。
i-BB_Width "の使用は不要 であるとのことです。このインジケータはアッパーバンドとローワーバンドの差分のみを計算します。 そのため、このインジケータをEAから完全に削除することができます。
その後、あなたのアルゴリズムのロジックをチェック するのはあなた次第です。
i-BB_Width "の使用は不要 であるとのことです。このインジケータはアッパーバンドとローワーバンドの差分のみを計算します。 そのため、このインジケータをEAから完全に削除することができます。
その後、あなたのアルゴリズムのロジックをチェックするのはあなた次第です。
素晴らしい解決策ですね。)
先生、ちょっとお聞きしたいことがあります。
EAで幅を変えることはできますか? 幅=アップバンド、ローバンド、ベースラインのように。
可能なのでしょうか?
ははは、いい解決策ですね。)
先生、ちょっとお聞きしたいことがあります。
EAで幅を変えることは可能でしょうか?
可能なのでしょうか?
申し訳ありませんが、私はあなたの質問を理解していない。
スペルミスがあり申し訳ありません。
帯域幅を求めたいのですが、そのためには以下のような計算が必要です。
幅=(上バンド-下バンド)/ベースバンド
この計算をEA内部で行うことは可能ですか?
どのようにこれを定義するのですか? 試したところ、エラーが出ました。
Width[]=(Upperband[]-Lowerband[])/Baseband[]と表示されました。
アドバイスお願いします。
- 無料取引アプリ
- 8千を超えるシグナルをコピー
- 金融ニュースで金融マーケットを探索
親愛なる皆様へ。
私はBバンドとB幅で動作するEAをプログラムしています、B幅のために私はカスタムEAを追加しました、私はコンパイルするときにエラーカンプスがありません。
しかし、私はそこにカスタムインジケータの 呼び出しでいくつかの問題があることを確信しています。
だから、私はそれを修正するためにいくつかのプログラマの助けを必要とする、私は今停止してしまったbcoz、今回私を助けてくれる人に感謝しなければならない常に。
ありがとうございました。