Jump to content

leeb77

Members
  • Posts

    89
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by leeb77

  1. Re: i have never seen anything indicators by pollon from russia

     

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

    //| pollon1.mq4 |

    //| Copyright © 2009, MetaQuotes Software Corp. |

    //| http://www.metaquotes.net |

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

    #property copyright "Copyright © 2009, MetaQuotes Software Corp."

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

     

    #property indicator_separate_window

     

    #property indicator_buffers 1

     

    #property indicator_color1 Red

     

    //---- buffers

     

    double ExtMapBuffer1[];

    double RSI1,CCI1,a1,a2,a3,max,min,an=0;

    extern int n=5;

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

    //| Custom indicator initialization function |

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

    int init()

    {

    SetIndexStyle(0,DRAW_LINE);

     

    SetIndexBuffer(0,ExtMapBuffer1);

     

    string short_name = "Pollon";

     

    IndicatorShortName(short_name);

    return(0);

    }

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

    //| Custom indicator deinitialization function |

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

    int deinit()

    {

    //----

     

    //----

    return(0);

    }

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

    //| Custom indicator iteration function |

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

    int start()

    {

    int counted_bars=IndicatorCounted();

     

    int shift=1;

     

    RSI1=iCustom(NULL,0,"RSI",0,shift);

    CCI1=iCustom(NULL,0,"CCI",0,shift);

     

    Comment(RSI1," ",CCI1);

     

    indi();

     

     

    return(0);

    }

     

     

     

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

     

    /*

     

    a1=(cci-rsi)

     

    a2=(cci[i-1]-rsi[i+1])-(cci-rsi)

     

    a3=(cci[i-2]-rsi[i+2])-(cci[i-1]-rsi[i+1])

     

    ....

     

    an=(cci[i-n]-rsi[i+n])-(cci[i-(n-1)]-rsi[i+(n-1)]) // I think this is general equation.

     

    tt1=max(a1+...+an)

     

    tt2=min(a1+...+an)

     

    res=tt1+tt1

     

    */

     

    void indi()

    {

    int counted_bars=IndicatorCounted();

     

    //---- check for possible errors

     

    if (counted_bars<0) return(-1);

     

    //---- last counted bar will be recounted

     

    if (counted_bars>0) counted_bars--;

     

    int pos=Bars-counted_bars;

     

    double dHigh , dLow , dResult;

     

     

    //---- main calculation loop

     

    while(pos>=0)

     

    {

    /*

    a1=(cci-rsi)

     

    a2=(cci[i-1]-rsi[i+1])-(cci-rsi)

     

    a3=(cci[i-2]-rsi[i+2])-(cci[i-1]-rsi[i+1])*/

     

    a1=(iCustom(NULL,0,"CCI",0,pos)-iCustom(NULL,0,"RSI",0,pos));

    a2=(iCustom(NULL,0,"CCI",0,pos-1)-iCustom(NULL,0,"RSI",0,pos+1))-(iCustom(NULL,0,"CCI",0,pos)-iCustom(NULL,0,"RSI",0,pos));

    a3=(iCustom(NULL,0,"CCI",0,pos-2)-iCustom(NULL,0,"RSI",0,pos+2))-(iCustom(NULL,0,"CCI",0,pos-1)-iCustom(NULL,0,"RSI",0,pos+1));

    an=(iCustom(NULL,0,"CCI",0,pos-n)-iCustom(NULL,0,"RSI",0,pos+n))-(iCustom(NULL,0,"CCI",0,pos-(n-1))-iCustom(NULL,0,"RSI",0,pos+(n-1)));

    //an=(cci[i-n]-rsi[i+n])-(cci[i-(n-1)]-rsi[i+(n-1)])

    /*

    dHigh = High[pos];

     

    dLow = Low[pos];*/

    if(a1>a2&&a1>a3&&a1>an){max=a1;}

    if(a2>a1&&a2>a3&&a2>an){max=a2;}

    if(a3>a1&&a3>a2&&a3>an){max=a3;}

    if(an>a1&&an>a2&&an>a3){max=an;}

     

    if(a1<a2&&a1<a3&&a1<an){min=a1;}

    if(a2<a1&&a2<a3&&a2<an){min=a2;}

    if(a3<a1&&a3<a2&&a3<an){min=a3;}

    if(an<a1&&an<a2&&an<a3){min=an;}

     

    dResult = max+min;

     

    ExtMapBuffer1[pos]= dResult ;

     

    pos--;

     

    }

    }

×
×
  • Create New...