[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Murrey Math Lines AFL



PureBytes Links

Trading Reference Links

Jacek,

It is nice to see you onboard the Amibroker list.

You may not know this but I have found that the original translation of
Kruzel's code did not always create the same MM lines as Murrey's EOD
software:

http://groups.yahoo.com/group/amibroker/message/32260

I think I have solved the problems with the help of wavemechanic and the DLL
is available here:

http://www.amibroker.net/3rdparty/MurreyMath.zip

I do have to thank you in that your spreadsheets have helped me in debugging
the problems I was finding.  The compilation spreadsheet that I sent you
specifically.

Thanks again,
Peter



-----Original Message-----
From: jac_gra <jacek.9320923@xxxxxxxxxxxxxxxx>
[mailto:jacek.9320923@xxxxxxxxxxxxxxxx]
Sent: Thursday, February 13, 2003 10:44 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Murrey Math Lines AFL


Here is AFL for drawing Murrey Math Lines
Let`s play with parameters.
Enjoy,
Jacek

/*******************************************/
// Murrey Math Lines (Horizontal)
// translated to AB from Metastock formula,
// created by member of murreymath egroup

GraphXSpace=1;
MaxGraph=16;

Period=Param("MM Period", 55, 4,256,1) ;
Graph1Color=6; Graph2Color=7;
Graph3Color=4; Graph4Color=5;
Graph5Color=6; Graph6Color=5;
Graph7Color=4; Graph8Color=7;

Graph9Color=6; Graph10Color=4;
Graph11Color=5;

Graph0=Close; Graph0Color=1; Graph0Style=64;

Graph1Style=1; Graph2Style=1;
Graph3Style=1; Graph4Style=1;
Graph5Style=1; Graph6Style=1;
Graph7Style=1; Graph8Style=1;
Graph9Style=1; Graph10Style=1;
Graph11Style=4;

SqW=Period;

T0=LastValue(Cum(1));

Sqrs=int((LastValue(Cum(1))-T0)/SqW)-1;

S0=T0+(Sqrs*SqW);

Lo=LastValue(ValueWhen(Cross(Cum(1),S0+SqW-1),
  LLV(Min(H,L),SqW),1));

Hi=LastValue(ValueWhen(Cross(Cum(1),S0+SqW-1),
 HHV(Max(H,L),SqW),1));

Sf=IIf(Hi>25,IIf(log(0.4*Hi)/log(10)-int(log(0.4*Hi)/log(10))>0,
exp(  log(10)*(int( log(0.4*Hi)/log(10) )+1) ),
exp(log(10)*(int(log(0.4*Hi)/log(10))))),
100*exp(log(8)*(int(log(0.005*Hi)/log(8)) ) ));

N=IIf(log(Sf/(Hi-Lo))/log(8)<=0,0,
   IIf(frac(log(Sf/(Hi-Lo))/log(8))==0,
      int(log(Sf/(Hi-Lo))/log(8) ),
      int( log(Sf/(Hi-Lo))/log(8) )+1) );

Si=Sf*exp(-N*log(8));

M=int(((1/log(2))*log((Hi-Lo)/Si))+.00001);

I=round(((Hi+Lo)*.5)/(Si*exp((M-1)*log(2))));

B=(I-1)*Si*exp((M-1)*log(2));
TT=(I+1)*Si*exp((M-1)*log(2));

Er=IIf(Hi-TT>0.25*(TT-B) OR
       B-Lo>0.25*(TT-B),1,0);

MM=IIf(Er=0,M,IIf(Er=1 AND M<2,M+1,0));
NN=IIf(Er=0,N,IIf(Er=1 AND M<2,N,N-1));

Si=Sf*exp(-NN*log(8));

I=round(((Hi+Lo)*.5)/
          (Si*exp((MM-1)*log(2))));

B=ValueWhen(Cum(1)>=S0,
            (I-1)*Si*exp((MM-1)*log(2)),1);

TT=ValueWhen(Cum(1)>=S0,
             (I+1)*Si*exp((MM-1)*log(2)),1);

Graph1=B;

Graph2=ValueWhen(Cum(1)>=S0,
                B+(0.125*(TT-B)),1);

Graph3=ValueWhen(Cum(1)>=S0,
                B+(2.0*(0.125*(TT-B))),1);

Graph4=ValueWhen(Cum(1)>=S0,
                B+(3.0*(0.125*(TT-B))),1);

Graph5=ValueWhen(Cum(1)>=S0,
                B+(4.0*(0.125*(TT-B))),1);

Graph6=ValueWhen(Cum(1)>=S0,
                B+(5.0*(0.125*(TT-B))));

Graph7=ValueWhen(Cum(1)>=S0,
                B+(6.0*(0.125*(TT-B))));

Graph8=ValueWhen(Cum(1)>=S0,
                B+(7.0*(0.125*(TT-B))));

Graph9=TT;

ml= (round( 8*( C - B ) / (TT-B) ) );
MM_buy=ml<2;  MM_Sell=ml>6;
 Title =   FullName()+ "\\c21 ="+ WriteVal( C )
+ WriteIf( IsEmpty( ml),"", WriteVal( ml )+ "/8")+"\\c19"+" _ " + Date
()+"\\c27"+WriteIf( ml<2," Buy?","") + "\\c32"+WriteIf( ml>6,"
Sell?","")  ;
/**********************************/


Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/