Difference between Pivots

casoni

Well-Known Member
#11
Hello ,
if i understood correctly ,
you want tp find the distance from daily pivot to weekly res and weekly sup ?
check this code below.
apply on chart .
see if you are looking for this or i didn't understand your issue.
thank you
HTML:
//http://www.traderji.com/amibroker/89109-difference-between-pivots.html
// amitrandive 
SetChartOptions(0, chartShowArrows|chartShowDates);   
TimeFrameSet(inDaily);  
PP = Ref( ((H + L + C)/3),-1) ;
dRange = Ref((H-L),-1) ;
dR1 = PP + PP-Ref(L,-1) ;
dS1 = PP - (Ref(H,-1)-PP);
DC= Ref(C,-1);
TimeFrameRestore();

TimeFrameSet(inWeekly);
PW = Ref( ((H + L + C)/3),-1) ;
wRange = Ref((H-L),-1) ;
wr1 = PW + PW-Ref(L,-1) ;
ws1 = PW - (Ref(H,-1)-PW);
PC= Ref (C,-1);
TimeFrameRestore();


dpp=TimeFrameExpand(PP,inDaily,expandFirst);
wpp=TimeFrameExpand(Pw,inWeekly,expandFirst);
wres=TimeFrameExpand(wr1,inWeekly,expandFirst);
wsup=TimeFrameExpand(ws1,inWeekly,expandFirst);

Plot(C,"",47,132);
Plot(dpp,"\nD.PP",6,25);
Plot(wpp,"\nW.pp",13,1);
Plot(wres,"\nW.Res",5,1);
Plot(wsup,"\nW.sup",4,1);
 Plot((dpp-wres),"\n\nDist from W.res ",7,styleNoDraw|styleOwnScale|styleNoLabel);
  Plot((dpp-wsup),"\nDist from W.sup ",7,styleNoDraw|styleOwnScale|styleNoLabel);

diffpoints = dpp-wpp;// This will show you diff in points
X = round(dpp - wpp);
Chg =Prec((X/wpp)*100,1); // This will show you diff in %


Filter=diffpoints AND chg ;// explore
AddColumn(diffpoints,"diff",1.2);
AddColumn(chg,"chg",1);
 

amitrandive

Well-Known Member
#15
Prabhu

If you want to find the difference between the Weekly R1 and daily pivot.You need to change the code

diffpoints = dpp-wpp;// This will show you diff in points
X = round(dpp - wpp);
Chg =Prec((X/wpp)*100,1); // This will show you diff in %
diffpoints1=dpp-wres;
Y=round(dpp-wres);
Chg =Prec((Y/dpp)*100,1); // This will show you diff in %

Filter=diffpoints AND chg ;// explore
AddColumn(diffpoints,"diff",1.2);
AddColumn(diffpoints1,"diff",1.2);
AddColumn(chg,"chg",1);