It is currently Sun May 20, 2012 5:43 pm

All times are UTC + 1 hour





Post new topic Reply to topic  [ 2 posts ] 
  Print view Previous topic | Next topic 
Author Message
 Post subject: CCI test
PostPosted: Wed Feb 10, 2010 8:55 pm 
Offline

Joined: Tue Jun 23, 2009 2:46 pm
Posts: 5
  1. //+------------------------------------------------------------------+
  2. //|                                            MultiTimeFrameCCI.mq5 |
  3. //|                                      Copyright 2010, Investeo.pl |
  4. //|                                                 http:Investeo.pl |
  5. //+------------------------------------------------------------------+
  6. #property copyright "2010, Investeo.pl"
  7. #property link      "http://Investeo.pl"
  8. #property version   "1.00"
  9. #property indicator_separate_window
  10.  
  11. #property indicator_buffers 3      
  12. #property indicator_plots 3  
  13.  
  14. #property indicator_color1 Red
  15. #property indicator_color2 Green
  16. #property indicator_color3 DarkSalmon
  17.  
  18. #property indicator_type1 DRAW_LINE          
  19. #property indicator_type2 DRAW_LINE
  20. #property indicator_type3 DRAW_LINE
  21.  
  22. #property indicator_width1  1
  23. #property indicator_width2  1
  24. #property indicator_width3  1
  25.  
  26. #property indicator_level1       -100.0
  27. #property indicator_level2        100.0
  28.  
  29. double vals_m1[];
  30. double vals_m2[];
  31. double vals_m3[];
  32.  
  33. int hCCI_m1, hCCI_m2, hCCI_m3;
  34. int ctx;
  35.  
  36. input int                  CCIPeriod      = 14;
  37. input ENUM_APPLIED_PRICE   AppliedPrice   = PRICE_TYPICAL;
  38.  
  39.  
  40. //+------------------------------------------------------------------+
  41. //| Custom indicator initialization function                         |
  42. //+------------------------------------------------------------------+
  43. int OnInit()
  44.   {
  45. //--- indicator buffers mapping
  46.    SetIndexBuffer(0, vals_m1,           INDICATOR_DATA);
  47.    SetIndexBuffer(1, vals_m2,           INDICATOR_DATA);
  48.    SetIndexBuffer(2, vals_m3,           INDICATOR_DATA);
  49.  
  50.    PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,CCIPeriod);
  51.    PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,CCIPeriod);
  52.    PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,CCIPeriod);
  53.  
  54. hCCI_m1 = iCCI(NULL, PERIOD_M1, CCIPeriod, AppliedPrice);
  55. hCCI_m2 = iCCI(NULL, PERIOD_M2, CCIPeriod, AppliedPrice);
  56. hCCI_m3 = iCCI(NULL, PERIOD_M3, CCIPeriod, AppliedPrice);
  57.  
  58. //---
  59.    return(0);
  60.   }
  61. //+------------------------------------------------------------------+
  62. //| Custom indicator iteration function                              |
  63. //+------------------------------------------------------------------+
  64. int OnCalculate(const int rates_total,
  65.                 const int prev_calculated,
  66.                 const datetime& time[],
  67.                 const double& open[],
  68.                 const double& high[],
  69.                 const double& low[],
  70.                 const double& close[],
  71.                 const long& tick_volume[],
  72.                 const long& volume[],
  73.                 const int& spread[])
  74.   {
  75. //---
  76.    ctx = CopyBuffer(hCCI_m1, 0, 0, rates_total, vals_m1);
  77.    if (ctx == -1)
  78.    {
  79.       Print("Error while m1 data copying. Error Number : ", GetLastError());
  80.       return 1;
  81.    }
  82.    ctx = CopyBuffer(hCCI_m2, 0, 0, rates_total, vals_m2);
  83.    if (ctx == -1)
  84.    {
  85.       Print("Error while m2 data copying. Error Number : ", GetLastError());
  86.       return 1;
  87.    }
  88.    ctx = CopyBuffer(hCCI_m3, 0, 0, rates_total, vals_m3);
  89.    if (ctx == -1)
  90.    {
  91.       Print("Error while m3 data copying. Error Number : ", GetLastError());
  92.       return 1;
  93.    }
  94.  
  95.    return(rates_total);
  96.   }
  97. //+------------------------------------------------------------------+
  98.  


Top
 Profile  
 
 Post subject: Re: CCI test
PostPosted: Wed Feb 10, 2010 9:31 pm 
Offline

Joined: Tue Jun 23, 2009 2:46 pm
Posts: 5
screenshot


Attachments:
MultiTimeFrameCCI.png
MultiTimeFrameCCI.png [ 86.76 KiB | Viewed 348 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO

skymiles v1.1 designed by CodeMiles Team -TemplatesDragon-.