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

[amibroker] Re: Pivot Points, Support & Resistance lines



PureBytes Links

Trading Reference Links

This plots all support and resistance levels...



Hi1 = IIf(Month()!=Ref(Month(),-1),Ref(HighestSince( Month()!=Ref
(Month(),-1), H,1),-1),0);
Hi = ValueWhen(Month()!=Ref(Month(),-1),Hi1,1);
Lo1 = IIf(Month()!=Ref(Month(),-1),Ref(LowestSince( Month()!=Ref
(Month(),-1), L,1),-1),0);
Lo = ValueWhen(Month()!=Ref(Month(),-1),Lo1,1);
CL1=IIf(Month()!=Ref(Month(),-1),Ref(C,-1),0);
CL = ValueWhen(Month()!=Ref(Month(),-1),CL1,1);
rg = Hi - Lo;
bp = (Hi+Lo+CL)/3;
R1 = (2*bP) - Lo ;
S1 = (2*bP) - Hi;
R2 = bP + rg;
S2 = bP - rg;

Plot(C,"Close",colorBlack,styleCandle);
Plot(bp,"Pivot",colorRed,styleBar);
Plot(R1,"R1",colorBlue,styleBar);
Plot(S1,"S1",colorBlue,styleBar);
Plot(R2,"R2",colorBlue,styleBar);
Plot(S2,"S2",colorBlue,styleBar);


// Automatic Oblique Fibonacci Lines
x = Cum(1);
per = 3;// calibrate the sensitivity
s1=L;s11=H;
pS = TroughBars( s1, per, 1 ) == 0;
endt= LastValue(ValueWhen( pS, x, 1 ));
startt=LastValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = LastValue(ValueWhen( pS, s1, 1 ) );
startS = LastValue( ValueWhen( pS, s1, 2  ));
aS = (endS-startS)/dtS;bS = endS;
trendlineS = aS * ( x  -endt ) + bS; 
SU = IIf(x>startt-1,trendlineS,-1e10);
Plot(SU,"SU",colorYellow,styleThick);
Plot(C,"C",1,64);b=BarIndex();
X1=ValueWhen(Cum(IsTrue(SU))==1,b);
Y1=ValueWhen(b==X1,SU);
X2=LastValue(b);Y2=LastValue(SU);
SLOPE=(Y2-Y1)/(X2-X1);
YP=LastValue(Highest(SU/SU*H));
XP=ValueWhen(H==YP,b);
HL0=YP+SLOPE*(b-XP);
DIST=ValueWhen(H==YP,H-SU);
HL1=YP-0.382*DIST+SLOPE*(b-XP);Plot(HL1,"\n0.382",colorRed,1);
HL2=YP-0.5*DIST+SLOPE*(b-XP);Plot(HL2,"\n0.500",colorRed,1);
HL3=YP-0.618*DIST+SLOPE*(b-XP);Plot(HL3,"\n0.618",colorRed,1);
Plot((HL1/HL1)*HL0,"\nRE",colorYellow,styleThick);

/// Plot EMA's ///

VarEMA200 = EMA(C,200);
VarEMA50 = EMA(C,50);
Plot(VarEMA50,"EMA50",colorWhite,styleDots);
Plot(VarEMA200,"EMA200",colorBlack,styleDots);

GraphXSpace=2;



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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