初心者の方からの質問 MQL5 MT5 MetaTrader 5 - ページ 777

 
Aleksey Vyazmikin:

OpenCLのカーネルを 書けるか?EAの実行中にOpenCLを使ってオンザフライで最適化すると言っている人を、私はここで一人だけ知っています。他に例を知りません。

自分でも見てみたいと思います。記事公開依頼までしておきながら、実際の取引にどう応用すればいいのか、運営側にはわからない。

すごいですね、openclはもう5年もサポートされているのに、取引の具体的な実例も記事もないなんて...まあ、開発者自身が応用方法を知らないのですから、クラウド最適化に注力しましょう。
 
ax237b:
5年も前からopenclをサポートしているのに、トレードや記事の具体的な事例がないなんて...開発者自身が適用方法を知らないのなら、クラウドの最適化に集中しようよ
何がそんなに驚きなのか?端末は十分な速度で動作し、ブローカーからの応答が遅れること。ということで、openclはひとまずお休みです。次に何が起こるか - それは見てのお楽しみ
 

助けてください!

インジケーターを作り直すのですが、以下が描画のコードです。

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots   3
//--- plot Label1
#property  indicator_label1  "High";
#property  indicator_type1   DRAW_LINE;
#property  indicator_color1  clrRed;
#property  indicator_style1  STYLE_DOT;
#property  indicator_width1  1;
//--- plot Label2
#property  indicator_label2  "Low";
#property  indicator_type2   DRAW_LINE;
#property  indicator_color2  clrRed;
#property  indicator_style2  STYLE_DOT;
#property  indicator_width2  1;
//--- plot Label3
#property  indicator_label3  "Close";
#property  indicator_type3   DRAW_LINE;
#property  indicator_color3  clrAquamarine;
#property  indicator_style3  STYLE_SOLID;
#property  indicator_width3  1;


//--- input parameters
input int InpChannelPeriod=48; // Period
//--- indicator buffers
double ExtHighBuffer[];
double ExtLowBuffer[];
double ExtCloseBuffer[];
//---
int i,limit,start;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtHighBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,ExtLowBuffer,INDICATOR_DATA);
   SetIndexBuffer(2,ExtCloseBuffer,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(2,PLOT_DRAW_BEGIN,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++) { ExtHighBuffer[i]=100.0; ExtLowBuffer[i]=0.0; ExtCloseBuffer[i]=50.0; } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+

スタイル#propertyindicator_style2STYLE_DOT; - チャートに一切描画 しない。

スタイル#propertyindicator_style2STYLE_SOLID; -STYLE_DOTで チャート上に描画します。

なんだこの異常は、私の手がおかしいのか?

 

グラフの配列から移動平均を 計算するには、ここかインジケータか、どちらが良いですか?

開発者が推奨する既成の関数やライブラリはありますか?

 
Aleksey Vyazmikin:

グラフの配列から移動平均を 計算するには、ここかインジケータか、どちらが良いですか?

もしかしたら、開発者が推奨する既成の関数やライブラリがあるのでは?


あるいは、iMAから地下のMAを描画するという単純なものでさえ、何も得られません :(

関数経由で呼び出している

double MA_TF(int index)
  {
   double MA[1];
   ResetLastError();
   if(CopyBuffer(handle_MA_TF,0,index,1,MA)<0)
     {
      PrintFormat("Failed to copy data from the handle_MA_TF indicator, error code %d",GetLastError());
      return(0.0);
     }
   return NormalizeDouble(MA[0],Digits());
  }

でも、おかしいな~、裏表が...。

 

ウィザードでMA_TF(rates_total-i)をインサイドアウトで呼び出したところ、効果があったようですが、履歴を見ると、時々、内蔵インジケータと不一致があるのですが(正規化を解除しても)、これは、どうなのでしょう?

また、インジケータに小数値を出力させるにはどうしたらよいでしょうか。

 
Aleksey Vyazmikin:

グラフの配列から移動平均を 計算するには、ここかインジケータか、どちらが良いですか?

開発者が推奨する既成の関数やライブラリはありますか?

IncludeフォルダにMovingAverages.mqhがあるのですが・・・。
 
Alexey Viktorov:
IncludeフォルダにMovingAverages.mqhがあるのですが・・・。

ありがとうございます!知らなかったのですが、どこをどうすればいいのか、例を見ることはできるのでしょうか?

 
Aleksey Vyazmikin:

ありがとうございます!知らなかったのですが、どこをどうすればいいのか、例を見ることはできるのでしょうか?

アレクセイ、検索がうまくいかなくなったのか?

右上にファイル検索があります。歯車をクリックすると、検索範囲を調整できます。


そして、その結果がこれです。


 
Alexey Viktorov:

Alexeiさん、検索が効かなくなったのですか?

右上にファイル検索があります。歯車をクリックすると、検索範囲を調整できます。


で、その結果がこちらです。



確かに、自分で検索してみてはいかがでしょうか。ありがとうございます

理由: