2010/11/12

ATCTradeを修正しました。

ATCTradeを修正しましたので、ご使用されている方はどうぞ!
また、DWTHarrのMQL5仕様の作成を依頼されましたが、途中で心が折れてしまったのでインジケーター指標として表示することができませんでした。サンプルとしてコメント表示のコードを掲示しておきますので試してみてください。(オブジェクト表示なら可能だと思います。)
  1. //+------------------------------------------------------------------+  
  2. //|                                                      DWTHarr.mq5 |  
  3. //|                                          Copyright 2010, bighope |  
  4. //|                       http://expertadviser-bighope.blogspot.com/ |  
  5. //+------------------------------------------------------------------+  
  6. #property copyright "Copyright 2010, bighope"  
  7. #property link      "http://expertadviser-bighope.blogspot.com/"  
  8. #property version   "1.00"  
  9. #property indicator_separate_window  
  10. #property indicator_buffers    1  
  11. #property indicator_plots      1  
  12. #property indicator_color1    Red  
  13. input int N     =  7;//対象データ数(2のN乗)  
  14. input int HBs   =  3;//高周波カット位置  
  15. input int LBs   =  4;//低周波カット位置  
  16. input int Shift =  0;//データのシフト数  
  17. int DWTPeriod;  
  18. //---------buffers  
  19. double IDWT[];  
  20. double g[];  
  21. double gs[];  
  22.   
  23. //+------------------------------------------------------------------+  
  24. //| Custom indicator initialization function                         |  
  25. //+------------------------------------------------------------------+  
  26. int OnInit()  
  27.   {  
  28. //--- indicator buffers mapping  
  29.    SetIndexBuffer(0,IDWT,INDICATOR_DATA);  
  30.    //ArraySetAsSeries(IDWT,false);  
  31.    PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0);  
  32.    DWTPeriod = MathPow(2,N);  
  33.    ArrayResize(g,DWTPeriod);  
  34.    ArrayResize(gs,DWTPeriod);  
  35.    ZeroMemory(g);  
  36.    ZeroMemory(gs);  
  37. //---  
  38.    return(0);  
  39.   }  
  40. //+------------------------------------------------------------------+  
  41. //| Custom indicator iteration function                              |  
  42. //+------------------------------------------------------------------+  
  43. int OnCalculate(const int rates_total,//Priceバッファ数  
  44.                 const int prev_calculated,//処理バー数  
  45.                 const int begin,//重要なデータが始まる所  
  46.                 const double &price[])  
  47.   {  
  48. //---  
  49. //PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,rates_total-DWTPeriod-1);  
  50.    string text;  
  51.    int     k;  
  52.    int     DWTf,z;  
  53.    double  sum,difference;  
  54.    for(k=0;k<DWTPeriod;k++)g[k] = price[rates_total-k-Shift-1];  
  55.    DWTf = DWTPeriod/2;  
  56.    //変換  
  57.    for(z=1;z<=N;z++)  
  58.    {  
  59.       for(k=0;k<DWTf;k++)  
  60.       {  
  61.          sum        =(g[k*2]+g[k*2+1])/2;  
  62.          difference =(g[k*2]-g[k*2+1])/2;  
  63.          gs[k]      =sum;  
  64.           if((LBs>=z)&&(z>=HBs)){gs[DWTf+k] = difference;}else{gs[DWTf+k] = 0;}//フィルタリング作業  
  65.        }  
  66.       ArrayCopy(g,gs);  
  67.       if(N>z) DWTf =DWTf/2;   
  68.     }  
  69.         
  70.     //逆変換  
  71.     for(z=1; z<=N ;z++)  
  72.     {  
  73.        
  74.       for(k = 0; k < DWTf; k++)   
  75.       {  
  76.          sum         =  g[k]+g[k+DWTf];  
  77.          difference  =  g[k]-g[k+DWTf];  
  78.          gs[2*k]       = sum;  
  79.          gs[2*k+1]     = difference;  
  80.       }  
  81.       ArrayCopy(g,gs);  
  82.       if(N>z)DWTf =2*DWTf;  
  83.      }  
  84.       for(k=0;k<DWTPeriod;k++){ IDWT[rates_total- Shift-k-1] = g[k];text += DoubleToString(g[k])+"\n";}   
  85.      //  for(k=DWTPeriod;k>0;k--){ IDWT[rates_total- Shift-k] = g[k-1]; }  
  86. //--- return value of prev_calculated for next call  
  87. Comment(text);  
  88.    return(rates_total);  
  89.   }  
  90. //+------------------------------------------------------------------+  

1 件のコメント :

Unknown さんのコメント...

DWThaarをMQ5で使用できるかトライして頂きまして、有難う御座いました。
また、ATC2010に参加中のお忙しい中、お時間を割いて頂きました事、合わせてお礼申し上げます。

ATC2010でのご活躍、お祈り申し上げます。