Jump to content

scratch

Members
  • Posts

    286
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by scratch

  1. Can some kind soul create the mq4 from this code please? Many thanks!

     

    //+------------------------------------------------------------------+

    //| BBands of CCI.mq4 |

    //| Bollinger Bands of CCI |

    //| Copyright © 2011, PDSoftware Corp. |

    //+------------------------------------------------------------------+

    #property copyright "Copyright © 2011, PDSoftware Corp."

    #property link "http://www.metaquotes.net"

     

    //----

     

    #property indicator_separate_window

    #property indicator_buffers 4

    #property indicator_color1 MediumSeaGreen

    #property indicator_color2 LightSeaGreen

    #property indicator_color3 LightSeaGreen

    #property indicator_color4 Red

     

    //---- indicator parameters

     

    extern int BandsPeriod=20;

    extern int BandsShift=0;

    extern double BandsDeviations=2.0;

    extern int CCIPeriod = 14;

     

    //---- buffers

    double MovingBuffer[];

    double UpperBuffer[];

    double LowerBuffer[];

    double CCIBuffer[];

     

    //+------------------------------------------------------------------+

    //| Custom indicator initialization function |

    //+------------------------------------------------------------------+

    int init()

    {

    //---- Set indicators

    SetIndexStyle(0,DRAW_LINE);

    SetIndexBuffer(0,MovingBuffer);

    SetIndexStyle(1,DRAW_LINE);

    SetIndexBuffer(1,UpperBuffer);

    SetIndexStyle(2,DRAW_LINE);

    SetIndexBuffer(2,LowerBuffer);

    SetIndexStyle(3,DRAW_LINE);

    SetIndexBuffer(3,CCIBuffer);

    //----

    SetIndexDrawBegin(0,BandsPeriod+BandsShift);

    SetIndexDrawBegin(1,BandsPeriod+BandsShift);

    SetIndexDrawBegin(2,BandsPeriod+BandsShift);

    SetIndexDrawBegin(3,CCIPeriod);

    //----

    SetLevelValue(0,100);

    SetLevelValue(1,-100);

    //----

    SetIndexLabel(0,"SMA");

    SetIndexLabel(1,"Upper");

    SetIndexLabel(2,"Lower");

    SetIndexLabel(3,"CCI");

     

    //---- name for DataWindow and indicator subwindow label

    IndicatorShortName("BBands of CCI("+BandsPeriod+","+DoubleToStr(BandsDeviations,1)+","+CCIPeriod+")");

     

    return(0);

    }

    //+------------------------------------------------------------------+

    //| Bollinger Bands of CCI |

    //+------------------------------------------------------------------+

    int start()

    {

    int i,k,counted_bars=IndicatorCounted();

    double deviation;

    double sum,oldval,newres;

    //----

    if(Bars<=BandsPeriod) return(0);

    //---- initial zero

    if(counted_bars<1)

    for(i=1;i<=BandsPeriod;i++)

    {

    MovingBuffer[bars-i]=EMPTY_VALUE;

    UpperBuffer[bars-i]=EMPTY_VALUE;

    LowerBuffer[bars-i]=EMPTY_VALUE;

    }

    //----

    int limit=Bars-counted_bars;

    if(counted_bars>0) limit++;

     

    //Calculate CCI

    for(i=0; i<limit; i++)

    CCIBuffer= iCCI(NULL,0,CCIPeriod,PRICE_TYPICAL,i);

     

    //Calculate MA of CCI x BBands

    for(i=0; i<limit; i++)

    MovingBuffer=iMAOnArray(CCIBuffer,Bars,BandsPeriod,0,MODE_SMA,i);

     

     

    //----

    i=Bars-BandsPeriod+1;

    if(counted_bars>BandsPeriod-1) i=Bars-counted_bars-1;

     

    //Calculate Upper & Lower Bands

    while(i>=0)

    {

    sum=0.0;

    k=i+BandsPeriod-1;

    oldval=MovingBuffer;

    while(k>=i)

    {

    newres=CCIBuffer[k]-oldval; //Refers to CCI !

    sum+=newres*newres;

    k--;

    }

    deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);

    UpperBuffer=oldval+deviation;

    LowerBuffer=oldval-deviation;

    i--;

    }

    //----

    return(0);

    }

    //+------------------------------------------------------------------+

  2. link deleted .... hope its ok now

     

    Thread is deleted because people continue to share the link or upload and post new links, if that happens the administrator or senior mods will take a call on whether to delete the thread

     

    In the case of the mm thread people continued to request and share the link that's why the administrator decided to delete the thread.

     

     

    What makes me laugh is how they even know about this sharing site in the first place ;)

    Can someone PM me with a link so I can see if this is just another BS hyped method - cheers.

×
×
  • Create New...