MQL4、MQL5に関する初心者からの質問、アルゴリズムやコードに関するヘルプ、ディスカッションなど。 - ページ 305 1...298299300301302303304305306307308309310311312...1953 新しいコメント Alexey Viktorov 2017.09.08 07:02 #3041 mila.com: ありがとうございます、でも私にはゼロを返します。その理由は何でしょうか? それ以外の理由ではありえない。1970年以下の年を知っているコンピュータはない。ブローカーの見積書に表示されている年号から始めます。 Vitaly Muzichenko 2017.09.08 07:40 #3042 Alexey Viktorov:他の年ではありえない。1970年以下の年を知っているコンピュータはない。ブローカーの見積書に表示されている年号から始めます。いい仕事してますね、私たちの時代の元年です(笑)。 Alexey Viktorov 2017.09.08 08:11 #3043 Vitaly Muzichenko:どうした、いいじゃないか、我々の時代の元年) そして、-1が1年目のBCとなる。 Aleksey Vyazmikin 2017.09.08 15:00 #3044 Artyom Trishkin: CopyXXX()を使用するありがとうございます。MT5では、このようにチャートを移動さ せることができます。PlotIndexSetInteger(0,PLOT_SHIFT,InpChannelPeriod); MT4でコンパイルするとエラーは出ないのですが、何も動作しないのですが、MT4の対応機種はありますか? Alexey Viktorov 2017.09.08 15:17 #3045 Aleksey Vyazmikin: ありがとうございます。MT5では、このようにチャートを移動さ せることが可能です。PlotIndexSetInteger(0,PLOT_SHIFT,InpChannelPeriod); MT4でコンパイルするとエラーは出ないのですが、何も動作しないのですが、MT4の対応機種はありますか? Пользовательские индикаторы - Справочник MQL4 docs.mql4.com Пользовательские индикаторы - Справочник MQL4 Aleksey Vyazmikin 2017.09.08 16:00 #3046 Alexey Viktorov: そこを選びました。SetIndexShift(0,InpChannelPeriod); しかし、その効果は全く異なるものです。つまり、コードが動作しない、ロジックが異なる、などなど...わかりません。 Aleksey Vyazmikin 2017.09.08 16:12 #3047 誰か助けてくれるかもしれません。 このインジケータの本質は、通常通りドネシアンチャネルを 描き、最後のチャネル値のラインをマイナスバーの後ろにずらすことです。MT5ではすべてうまくいっているようですが、MT4では何が問題なのかわかりません。あちこち描き直しましたが、やはり無意味に描画されます。別途、ずれる値の計算をしていますが、チャンネルそのものがずれてしまいます。//+------------------------------------------------------------------+ //| Donchian_Channel.mq5 | //+------------------------------------------------------------------+ #property copyright "Vyazmikin Aleksey Vyacheslavovich" #property link "https://www.mql5.com/ru/users/-aleks-" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 2 //--- plot Label1 #property indicator_label1 "High_Prognoz"; #property indicator_type1 DRAW_LINE; #property indicator_color1 clrAquamarine; #property indicator_style1 STYLE_DOT; #property indicator_width1 1; //--- plot Label2 #property indicator_label2 "Low_Prognoz"; #property indicator_type2 DRAW_LINE; #property indicator_color2 clrAquamarine; #property indicator_style2 STYLE_DOT; #property indicator_width2 1; //--- input parameters input int InpChannelPeriod=48; // Period //--- indicator buffers double ExtHighBufferPrognoz[]; double ExtLowBufferPrognoz[]; //--- int i,limit,start; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,ExtHighBufferPrognoz,INDICATOR_DATA); SetIndexBuffer(1,ExtLowBufferPrognoz,INDICATOR_DATA); //--- set accuracy IndicatorSetInteger(INDICATOR_DIGITS,_Digits); //--- set first bar from what index will be drawn SetIndexDrawBegin(0,InpChannelPeriod); SetIndexDrawBegin(1,InpChannelPeriod); SetIndexShift(0,InpChannelPeriod); SetIndexShift(1,InpChannelPeriod); //--- return(0); } //+------------------------------------------------------------------+ //| 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[]) { //--- check for rates if(rates_total<InpChannelPeriod*2) return(0); //--- preliminary calculations if(prev_calculated==0) limit=InpChannelPeriod; else limit=prev_calculated; //--- the main loop of calculations for(i=limit;i<rates_total && !IsStopped();i++) { start=i-InpChannelPeriod; ExtHighBufferPrognoz[i-InpChannelPeriod]=high[ArrayMaximum(high,InpChannelPeriod,start)]; ExtLowBufferPrognoz[i-InpChannelPeriod] =low[ArrayMinimum(low,InpChannelPeriod,start)]; } for(int x=rates_total-InpChannelPeriod;x<rates_total && !IsStopped();x++) { ExtHighBufferPrognoz[x]=ExtHighBufferPrognoz[rates_total-InpChannelPeriod]; ExtLowBufferPrognoz[x]=ExtLowBufferPrognoz[rates_total-InpChannelPeriod]; } //--- return value of prev_calculated for next call return(rates_total); } Alexey Viktorov 2017.09.08 16:48 #3048 Aleksey Vyazmikin:誰か助けてくれるかもしれません。 このインジケータの本質は、通常通りドネシアンチャネルを描き、最後のチャネル値のラインをマイナスバーの後ろにずらすことです。MT5ではすべてうまくいっているようですが、MT4では何が問題なのかわかりません。あちこち描き直しましたが、やはり無意味に描画されます。別途、ずれる値の計算をしていますが、チャンネル自体がずれてしまうのです・・・。ワニのコードを見てください、そこにシフトが効いているんです。とはいえ、もしかしたら理屈は違うかもしれませんが。 Aleksey Vyazmikin 2017.09.08 18:04 #3049 Alexey Viktorov:まあ、ワニのコードを見てくださいよ、あそこはシフトが効くんですよ。理屈は違うかもしれませんが。はい、シフトは私にも有効です。配列にシフトをかけると、シフトがないかのように充填されますが、シフト自体は視覚的に起こります。コードの最初の部分は、最後のバーからInpChannelPeriodの 深さまでバッファを満たさないままにしておきます。 for(i=limit;i<rates_total && !IsStopped();i++) { start=i-InpChannelPeriod; ExtHighBufferPrognoz[i-InpChannelPeriod]=high[ArrayMaximum(high,InpChannelPeriod,start)]; ExtLowBufferPrognoz[i-InpChannelPeriod] =low[ArrayMinimum(low,InpChannelPeriod,start)]; }第2部では、この部分を埋める必要があります。 for(int x=rates_total-InpChannelPeriod;x<rates_total && !IsStopped();x++) { ExtHighBufferPrognoz[x]=ExtHighBufferPrognoz[rates_total-InpChannelPeriod]; ExtLowBufferPrognoz[x]=ExtLowBufferPrognoz[rates_total-InpChannelPeriod]; }しかし、実際はこのような結果になるのです。 Aleksey Vyazmikin 2017.09.08 18:09 #3050 MT5でのコード#property strict #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 2 //--- plot Label1 #property indicator_label1 "Predicted_high_price"; #property indicator_type1 DRAW_LINE; #property indicator_color1 clrAquamarine; #property indicator_style1 STYLE_DOT; #property indicator_width1 1; //--- plot Label2 #property indicator_label2 "Predicted_low_price"; #property indicator_type2 DRAW_LINE; #property indicator_color2 clrAquamarine; #property indicator_style2 STYLE_DOT; #property indicator_width2 1; //--- input parameters input int InpChannelPeriod=48; // Period //--- indicator buffers double ExtHighBufferPrognoz[]; double ExtLowBufferPrognoz[]; //--- int i,limit,start; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,ExtHighBufferPrognoz,INDICATOR_DATA); SetIndexBuffer(1,ExtLowBufferPrognoz,INDICATOR_DATA); //--- set accuracy IndicatorSetInteger(INDICATOR_DIGITS,_Digits); //--- set first bar from what index will be drawn PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpChannelPeriod); PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,InpChannelPeriod); PlotIndexSetInteger(0,PLOT_SHIFT,InpChannelPeriod); PlotIndexSetInteger(1,PLOT_SHIFT,InpChannelPeriod); //--- return(0); } //+------------------------------------------------------------------+ //| 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[]) { //--- check for rates if(rates_total<InpChannelPeriod) return(0); //--- preliminary calculations if(prev_calculated==0) limit=InpChannelPeriod; else limit=prev_calculated; //--- the main loop of calculations for(i=limit;i<rates_total && !IsStopped();i++) { start=i-InpChannelPeriod; ExtHighBufferPrognoz[i-InpChannelPeriod]=high[ArrayMaximum(high,start,InpChannelPeriod)]; ExtLowBufferPrognoz[i-InpChannelPeriod]=low[ArrayMinimum(low,start,InpChannelPeriod)]; } for(int x=rates_total-InpChannelPeriod;x<rates_total && !IsStopped();x++) { //int calc=x--; ExtHighBufferPrognoz[x]=ExtHighBufferPrognoz[rates_total-InpChannelPeriod-1]; ExtLowBufferPrognoz[x]=ExtLowBufferPrognoz[rates_total-InpChannelPeriod-1]; } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+結果 ZS: コードを変更しました。間違ったMEは 1...298299300301302303304305306307308309310311312...1953 新しいコメント 取引の機会を逃しています。 無料取引アプリ 8千を超えるシグナルをコピー 金融ニュースで金融マーケットを探索 新規登録 ログイン スペースを含まないラテン文字 このメールにパスワードが送信されます エラーが発生しました Googleでログイン WebサイトポリシーおよびMQL5.COM利用規約に同意します。 新規登録 MQL5.com WebサイトへのログインにCookieの使用を許可します。 ログインするには、ブラウザで必要な設定を有効にしてください。 ログイン/パスワードをお忘れですか? Googleでログイン
ありがとうございます、でも私にはゼロを返します。その理由は何でしょうか?
それ以外の理由ではありえない。1970年以下の年を知っているコンピュータはない。ブローカーの見積書に表示されている年号から始めます。
他の年ではありえない。1970年以下の年を知っているコンピュータはない。ブローカーの見積書に表示されている年号から始めます。
いい仕事してますね、私たちの時代の元年です(笑)。
どうした、いいじゃないか、我々の時代の元年)
CopyXXX()を使用する
ありがとうございます。
MT5では、このようにチャートを移動さ せることができます。
PlotIndexSetInteger(0,PLOT_SHIFT,InpChannelPeriod);
ありがとうございます。
MT5では、このようにチャートを移動さ せることが可能です。
PlotIndexSetInteger(0,PLOT_SHIFT,InpChannelPeriod);
そこを選びました。
SetIndexShift(0,InpChannelPeriod);
誰か助けてくれるかもしれません。 このインジケータの本質は、通常通りドネシアンチャネルを 描き、最後のチャネル値のラインをマイナスバーの後ろにずらすことです。
MT5ではすべてうまくいっているようですが、MT4では何が問題なのかわかりません。あちこち描き直しましたが、やはり無意味に描画されます。別途、ずれる値の計算をしていますが、チャンネルそのものがずれてしまいます。
誰か助けてくれるかもしれません。 このインジケータの本質は、通常通りドネシアンチャネルを描き、最後のチャネル値のラインをマイナスバーの後ろにずらすことです。
MT5ではすべてうまくいっているようですが、MT4では何が問題なのかわかりません。あちこち描き直しましたが、やはり無意味に描画されます。別途、ずれる値の計算をしていますが、チャンネル自体がずれてしまうのです・・・。
ワニのコードを見てください、そこにシフトが効いているんです。とはいえ、もしかしたら理屈は違うかもしれませんが。
まあ、ワニのコードを見てくださいよ、あそこはシフトが効くんですよ。理屈は違うかもしれませんが。
はい、シフトは私にも有効です。
配列にシフトをかけると、シフトがないかのように充填されますが、シフト自体は視覚的に起こります。
コードの最初の部分は、最後のバーからInpChannelPeriodの 深さまでバッファを満たさないままにしておきます。
第2部では、この部分を埋める必要があります。
しかし、実際はこのような結果になるのです。
MT5でのコード
結果
![](https://c.mql5.com/3/153/Si_SpliceH1__1.png)
ZS: コードを変更しました。間違ったMEは