Solar_Wind_clean_XSm_mtf

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Solar_Wind_clean_XSm_mtf
//+------------------------------------------------------------------+
//| Solar wind clean XSm(based on Solar wind clean  (FisherTransform)|
//| revised by Mladen    Copyright © 2005, MetaQuotes Software Corp. |
//| ForexTSD mladen nittany  mod fxbs  ki http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2005,  MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/ www.ForexTSD.com"

//---- indicator settings

#property  copyright ""
#property  link      ""

#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  Lime
#property  indicator_color2  Red
#property  indicator_color3  DodgerBlue
#property  indicator_color4  Gold
 
extern int period    = 10;
extern int smoozing  = 2;
extern int LShift    = 1;
extern int SLShift   = 1;
extern int TimeFrame = 0;

extern string  note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
extern string  IndicatorCorrectName = "Solar_Wind_clean_XSm_mtf";
extern string  note___Ind_Name = "if indicator Name changed - enter New Name";




double         ExtBuffer0[];
double         ExtBuffer1[];
double         ExtBuffer2[];
double         Value[];
double         ExtBuffer3[];
double         ExtBuffer4[];


int init()
{
   IndicatorBuffers(6);
   SetIndexBuffer(0,ExtBuffer1);
   SetIndexBuffer(1,ExtBuffer2);
   SetIndexBuffer(2,ExtBuffer3);   
   SetIndexBuffer(3,ExtBuffer4); 
   SetIndexBuffer(4,ExtBuffer0);
   SetIndexBuffer(5,Value);


   if (TimeFrame==0) TimeFrame = Period();
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexShift(2,LShift*TimeFrame/Period());
   SetIndexStyle(3,DRAW_LINE);
   SetIndexShift(3,SLShift*TimeFrame/Period());

//---  mod to show currency pair and Period by nittany1 forex-tsd
//     IndicatorShortName("SOLAR WIND Clean("+Symbol()+","+period+")");
 
    IndicatorShortName("SOLARWIND CleanXS ("+period+"|"+smoozing+")[TF"+TimeFrame+"]");
    IndicatorDigits(Digits+1);
    if (TimeFrame < Period()) TimeFrame = Period();


   return(0);
}


int start()
{
  
   int counted_bars1=IndicatorCounted();
   int      limit1,i1;
   if(counted_bars1 < 0) return(-1);
   limit1 = Bars-counted_bars1;
   if (TimeFrame != Period())
      {
         limit1 = MathMax(limit1,TimeFrame/Period());
         datetime TimeArray[];
        ArrayCopySeries(TimeArray ,MODE_TIME ,NULL,TimeFrame);
            for(i1=0,int y=0; i1<limit1; i1++)
           {
              if(Time[i1]<TimeArray[y]) y++;
              ExtBuffer1   [i1]   = iCustom(NULL,TimeFrame,IndicatorCorrectName,period,0,y);
              ExtBuffer2   [i1]   = iCustom(NULL,TimeFrame,IndicatorCorrectName,period,1,y);
              ExtBuffer3   [i1]   = iCustom(NULL,TimeFrame,IndicatorCorrectName,period,2,y);
              ExtBuffer4   [i1]   = iCustom(NULL,TimeFrame,IndicatorCorrectName,period,3,y);

            }
         return(0);         
      }


   int   limit;
   int   counted_bars=IndicatorCounted();

   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;

   for(int i=limit; i>=0; i--)
   {  
      double MaxH  = High[iHighest(NULL,0,MODE_HIGH,period,i)];
      double MinL  = Low [iLowest( NULL,0,MODE_LOW, period,i)];
      double price = (High[i]+Low[i])/2;
      if (MaxH!=MinL)
              Value[i] = 0.33*2*((price-MinL)/(MaxH-MinL)-0.5);

 
      else  Value[i] = 0.00;
            Value[i] = MathMin(MathMax(Value[i],-0.999),0.999); 
            ExtBuffer0[i]=0.5*MathLog((1+Value[i])/(1-Value[i]));

     }     

         for( i=limit; i>=0; i--)
     {
    
            ExtBuffer3[i]=iMAOnArray(ExtBuffer0,0,smoozing,0,MODE_EMA,i);


      //
      //
      //
      //
      //
      
      if(ExtBuffer3[i]<0)
        {
         ExtBuffer2[i]=ExtBuffer3[i];
         ExtBuffer1[i]=0.0;
        }
      else
         {
         ExtBuffer1[i]=ExtBuffer3[i];
         ExtBuffer2[i]=0.0;
         }
      }
 //  
 //
 //
          for( i=limit; i>=0; i--)
            {
             ExtBuffer4[i]=iMAOnArray(ExtBuffer3,0,smoozing,0,MODE_EMA,i);
            }

 
   
   return(0);
}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---