Sinus 7 Cosinus Wave - Please help

 

Hello,

I try to code an indicator in a separate window which is displaying a consistent wave between 1 and -1.
the length of the waves should be adjustable.

Does anybody know such an indicator? It would be great to use it with the dominant cycle and show the market cycles.

thank you and best regards,
mike

 
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- buffers
double sin[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,sin);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

extern double streching=0.1;
double pi=3.14159265;
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   for(int i =Bars-counted_bars-1;i>=0;i--){
      sin[i]=MathSin((i*streching));
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
looks very interesting.. zzuegg, have you coded any EA with this indicator? By the way, I went to your web site and didn't find any EA's on there.. indicators look interesting
 

No this was only an example to show you how to create a sinus wave looking indicator. For a cycle analysis you need a streching and a shift variable.

BTW, this indicator works only in history, for the current bar, (i is always 0) it will not change value-

You have to find a starting point and the peaks/bottoms, maybe in combination with some regression analysis to draw automatic cycles, if you combine multiple timeframes you might get an overview of the dominat cycles.

Yea, website is beeing reworked, so currently we are not anymore updating this one. I have currently EA are currently in testing, they are not yet on the site because i am going to offer only forward tested EA's and i currently do not have enough testing data for a good strategy summary.

cheers

Michael

 

you are my hero, thank you very much :)

so if i know the dominant cycle period, the phase and the amplitude, would it be possible to addapt these informations to this indicator?


than you and best regards,

mike

 

sure, the amplitude is not needed, the phase would be the same as the streching variable in the code from above, and the shift would be easy to implement, just change

sin[i]=MathSin((i*streching));

TO

sin[i]=MathSin(((i+shift)*streching));

 
zzuegg:

sure, the amplitude is not needed, the phase would be the same as the streching variable in the code from above, and the shift would be easy to implement, just change

sin[i]=MathSin((i*streching));

TO

sin[i]=MathSin(((i+shift)*streching));


Did you try doing any EA with this Sinus indicator? Also what is your Scalpers Sweetspot is based upon?
 
i have sent you a pm
Reason: