"Golden Arches" Project

Discussion in 'Forex' started by ElectricSavant, Jan 20, 2007.

  1. fifo

    fifo


    what version or filename are you using currently?
     
    #391     Feb 8, 2007
  2. CR_v1

     
    #392     Feb 8, 2007
  3. fifo

    fifo


    and the only change you want is a default to 382?
     
    #393     Feb 8, 2007
  4. This would make the default easier to present as a download...the lines are at Hi, 61.8, 38.2, -38.2, -61.8 Lo..

    I cannot remember if i manually did this or if the download was updated...but this was the next to the last download from you or RJB. (the last download had some stuff I do not use...murry math lines in the Demarker)

    also if i thicken the Hi and low line it does not save...from MT4 closure...to the next opening...perhaps this is an mt4 thing and do not sweat it...


     
    #394     Feb 8, 2007
  5. fifo

    fifo


    Right click on the indicator and let me know its name to make sure we are talking about the same version...
     
    #395     Feb 8, 2007
  6. I have cr_v1 in my charts and I deleted all of the other versions...Thank you for the detail and carefullness (I had to delete email links in the code below, which is not my work).

    /*
    ----------------------------------------------------------------------

    Indicator : cr_v1.mq4
    Version : v1.02b
    Author : ang/fifo/rjb
    Copyright : based on work by
    Date : 1-Feb-2007
    Contact :
    Notes : Plot DAILY curvirank on other timeframes with fib channel

    ----------------------------------------------------------------------
    */

    #include <WinUser32.mqh>

    #property indicator_chart_window

    #property indicator_buffers 7
    #property indicator_color1 DodgerBlue
    #property indicator_color2 DimGray
    #property indicator_color3 DimGray
    #property indicator_color4 DimGray
    #property indicator_color5 DimGray
    #property indicator_color6 DimGray
    #property indicator_color7 DimGray


    double buf1[];
    double buf2[];
    double buf3[];
    double buf4[];
    double buf5[];
    double buf6[];
    double buf7[];

    extern int PriceSeriesOHLC_0123 = 0;
    extern double BarPeriod = 299;
    extern int Order = 2;

    extern double FIB_1 = 0.618;
    extern double FIB_2 = 0.213;

    double ai[10,10],b[10],x[10],sx[20];
    double sum;
    int p,n,sName=-1,f=0;
    double qq,mm,tt;
    int ii,jj,kk,ll,nn;
    int i=0;

    //+------------------------------------------------------------------+
    int init()
    {

    SetIndexStyle(0,DRAW_LINE,STYLE_DOT,1);
    SetIndexBuffer(0,buf1);
    SetIndexStyle(1,DRAW_LINE,STYLE_DOT,1);
    SetIndexBuffer(1,buf2);
    SetIndexStyle(2,DRAW_LINE,STYLE_DOT,1);
    SetIndexBuffer(2,buf3);
    SetIndexStyle(3,DRAW_LINE,STYLE_DOT,1);
    SetIndexBuffer(3,buf4);
    SetIndexStyle(4,DRAW_LINE,STYLE_DOT,1);
    SetIndexBuffer(4,buf5);
    SetIndexStyle(5,DRAW_LINE,STYLE_DOT,1);
    SetIndexBuffer(5,buf6);
    SetIndexStyle(6,DRAW_LINE,STYLE_DOT,1);
    SetIndexBuffer(6,buf7);

    if (sName == -1)
    sName=TimeCurrent();

    p=BarPeriod-1;

    nn=Order+1;

    return(0);
    }

    //+------------------------------------------------------------------+
    int deinit()
    {
    ObjectDelete("cr"+sName);

    ObjectDelete( "crHI");
    ObjectDelete( "crLO");
    ObjectDelete( "crFIB1u");
    ObjectDelete( "crFIB2u");
    ObjectDelete( "crFIB1d");
    ObjectDelete( "crFIB2d");

    }

    //+------------------------------------------------------------------+
    int start()
    {
    int mi;

    if (f==1)
    p = iBarShift(Symbol(),Period(),ObjectGet("cr"+sName,OBJPROP_TIME1));

    sx[1] = p+1;
    SetIndexDrawBegin(0,Bars-p-1);
    for ( mi=1;mi<=nn*2-2;mi++ )
    {
    sum=0;
    for(n=i;n<=i+p;n++)
    sum+=MathPow(n,mi);
    sx[mi+1]=sum;
    }
    for ( mi=1;mi<=nn;mi++ )
    {
    sum=0.00000;
    for(n=i;n<=i+p;n++)
    {
    if (mi==1)
    sum+=GetAppliedPrice(PriceSeriesOHLC_0123,n);
    else
    sum+=GetAppliedPrice(PriceSeriesOHLC_0123,n)*MathPow(n,mi-1);
    }
    b[mi]=sum;
    }

    // Matrix
    for(jj=1;jj<=nn;jj++)
    for(ii=1; ii<=nn; ii++)
    {
    kk = ii+jj-1;
    ai[ii,jj] = sx[kk];
    }

    //Gauss
    for(kk=1; kk<=nn-1; kk++)
    {
    ll=0;
    mm=0;
    for(ii=kk; ii<=nn; ii++)
    {
    if (MathAbs(ai[ii,kk])>mm)
    {
    mm=MathAbs(ai[ii,kk]);
    ll=ii;
    }
    }
    if (ll==0)
    {
    MessageBox("xxx-1");
    return(0);
    }
    if (ll!=kk)
    {
    for(jj=1; jj<=nn; jj++)
    {
    tt=ai[kk,jj];
    ai[kk,jj]=ai[ll,jj];
    ai[ll,jj]=tt;
    }
    tt=b[kk];
    b[kk]=b[ll];
    b[ll]=tt;
    }
    for(ii=kk+1;ii<=nn;ii++)
    {
    qq=ai[ii,kk]/ai[kk,kk];
    for(jj=1;jj<=nn;jj++)
    {
    if (jj==kk)
    ai[ii,jj]=0;
    else
    ai[ii,jj]=ai[ii,jj]-qq*ai[kk,jj];
    }
    b[ii]=b[ii]-qq*b[kk];
    }
    }

    x[nn]= b[nn]/ai[nn,nn];
    for(ii=nn-1;ii>=1;ii--)
    {
    tt=0;
    for(jj=1;jj<=nn-ii;jj++)
    {
    tt = tt+ai[ii,ii+jj]*x[ii+jj];
    x[ii] = (1/ai[ii,ii])*(b[ii]-tt);
    }
    }

    // double hi = iHigh(Symbol(),0,iHighest(Symbol(),0,MODE_HIGH,p,0));
    // double lo = iLow(Symbol(),0,iLowest(Symbol(),0,MODE_LOW,p,0));

    double dHi=0;
    double dLo=0;
    int j;
    for (n=i;n<=i+p;n++)
    {
    sum=0;
    for(kk=1;kk<=Order;kk++)
    sum += x[kk+1]*MathPow(n,kk);
    buf1[n] = x[1]+sum;

    // calc max hi & lo devation from cr-line
    double hi = iHigh(Symbol(),0,n);
    double lo = iLow(Symbol(),0,n);
    if ( hi > buf1[n] )
    {
    j = (hi - buf1[n]) / Point;
    dHi = MathMax(j,dHi);
    }
    if ( lo < buf1[n] )
    {
    j = (buf1[n] - lo) / Point;
    dLo = MathMax(j,dLo);
    }
    }

    // msg(""+dHi+":"+dLo);

    // plot hi/lo channel
    for ( n=0; n<p; n++ )
    {
    buf4[n] = buf1[n] + dHi * Point;
    buf7[n] = buf1[n] - dLo * Point;
    buf3[n] = buf1[n] + dHi * FIB_1 * Point;
    buf6[n] = buf1[n] - dLo * FIB_1 * Point;
    buf2[n] = buf1[n] + dHi * FIB_2 * Point;
    buf5[n] = buf1[n] - dLo * FIB_2 * Point;
    if ( n == 0 )
    {
    showLabel( "crHI", "Hi", buf4[n] );
    showLabel( "crLO", "Lo", buf7[n] );
    showLabel( "crFIB1u", "+"+DoubleToStr(100*FIB_1,1),buf3[n] );
    showLabel( "crFIB1d", "-"+DoubleToStr(100*FIB_1,1),buf6[n] );
    showLabel( "crFIB2u", "+"+DoubleToStr(100*FIB_2,1),buf2[n] );
    showLabel( "crFIB2d", "-"+DoubleToStr(100*FIB_2,1),buf5[n] );
    }
    }

    ObjectCreate("cr"+sName,OBJ_ARROW,0,Time[p],buf1[p]);
    ObjectSet("cr"+sName,OBJPROP_ARROWCODE,159);
    ObjectSet("cr"+sName,OBJPROP_TIME1,Time[p]);
    ObjectSet("cr"+sName,OBJPROP_PRICE1,buf1[p]);

    f=1;

    return(0);
    }

    //+------------------------------------------------------------------+
    double GetAppliedPrice(int nAppliedPrice, int nIndex)
    {
    double dPrice;
    switch(nAppliedPrice)
    {
    case 0: dPrice=Open[nIndex]; break;
    case 1: dPrice=High[nIndex]; break;
    case 2: dPrice=Low[nIndex]; break;
    case 3: dPrice=Close[nIndex]; break;
    case 4: dPrice=(High[nIndex]+Low[nIndex])/2.0; break;
    case 5: dPrice=(High[nIndex]+Low[nIndex]+Close[nIndex])/3.0; break;
    case 6: dPrice=(High[nIndex]+Low[nIndex]+2*Close[nIndex])/4.0; break;
    default: dPrice=0.0;
    }
    return(dPrice);
    }

    //+------------------------------------------------------------------+
    void showLabel( string n, string x, double lvl )
    {
    int i = -2;
    if ( ObjectMove(n,0,iTime(Symbol(),0,0),lvl+i*Point) == FALSE )
    {
    ObjectCreate(n,OBJ_TEXT,0,iTime(Symbol(),0,0),lvl+i*Point);
    ObjectSetText(n, x, 8, "Tahoma", Gray);
    }

    }
    //+------------------------------------------------------------------+
    void msg( string m )
    {
    MessageBoxA(NULL ,m,"Trace",MB_OK);
    }

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







     
    #396     Feb 8, 2007
  7. fifo

    fifo



    Good, looks like its V1B as per the header in the source. Good thing to remeber from now on is to look at the header and or the downloaded filename and not the indicator name...


    ok, how are these settings?
    changes:
    solid line for center.
    wider dashed lines for fibs (so they don't look like the grid lines)
    yellow default colors for Fibs
    thicker Hi/Lo fibs
    382 default instead of 213
     
    #397     Feb 8, 2007
  8. Just fricken awesome..

    can you post the zip file and may I use it and post it in the presentation of this method in the new thread?

    Assuming I have your permission, could you rename it to match the header?

    Michael B.

    P.S. I am sorry to hear about all of your wealth lab work wasted.


     
    #398     Feb 8, 2007
  9. fifo

    fifo

    No Problem (on all counts), this has been an amazing learning experience to say the least...and trading hasn't even begun!
    Give this a try...
     
    #399     Feb 8, 2007
  10. guys..this is so easy...

    just open the zip file and extract all files to: (copy and paste this below in the extraction wizard)

    C:\Program Files\MetaTrader - North Finance\experts\indicators

    then drag it in to one chart from the navigator menu and save the template and viola...load the templates in any chart you wish




     
    #400     Feb 8, 2007