DR Strategy

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3
At a glance
Powered by AI
The code is calculating pivot point levels and ranges on different timeframes (daily, weekly) as well as analyzing the daily range and adding it as columns for further analysis.

The PIVOT BOSS indicator is calculating pivot point levels (R1, R2, R3, R4 and S1, S2, S3, S4) on the daily and weekly timeframes based on the high, low and close of previous periods.

The different sections are calculating: 1) daily pivot points and range analysis, 2) current daily pivot points, 3) previous weekly pivot points, 4) current weekly pivot points, and 5) additional exploratory calculations.

// PIVOTBOSS ADR - USE IN DAILY PLUS TF.

// PIVOT BOSS PIVOTS

_SECTION_BEGIN("PIVOT BOSS ADR");


GraphLabelDecimals = 2;

dys = Param("days",1,1,10,1);
//hi = Max(TimeFrameGetPrice("H",inDaily,0),TimeFrameGetPrice("H",inDaily,-1)); //
Ref(HHV(H,dys),0);
//lo = Min(TimeFrameGetPrice("L", inDaily,0),TimeFrameGetPrice("L",inDaily,-
1));; //Ref(LLV(L,dys),0);
//hi1 = Max(TimeFrameGetPrice("H",inDaily,0),TimeFrameGetPrice("H",inDaily,0)); //
Ref(HHV(H,dys),0);
//lo1 = Min(TimeFrameGetPrice("L",
inDaily,0),TimeFrameGetPrice("L",inDaily,0));; //Ref(LLV(L,dys),0);

hi = H; //HHV(H,dys); //Ref(HHV(H,dys),0);
lo = L; //LLV(L,dys); //Ref(LLV(L,dys),0);
hi1 = Ref(HHV(H,dys),0);
lo1 = Ref(LLV(L,dys),0);

DR = (hi-lo);

ADR10 = MA(dr,10);

ADR5 = MA(dr,5);

EX = ADR10 * 1.25;
CM = ADR10 * 0.65;

BARCOL = IIf(DR < CM,colorYellow,IIf(DR > EX, colorWhite,colorGreen));


Plot(DR,"DRn",barcol,styleHistogram|styleThick, Null, Null, 0, 0, 5);
Plot(EX,"ADR1.25",COLORWHITE,styleLINE,styleThick,0,0,3);
Plot(CM,"ADR0.65",colorBrightGreen,styleLINE,styleThick,0,0,3);
Plot(0,"",colorWhite,styleLine);
TRENDPOTENTIAL = DR < CM;
_SECTION_END();

// PIVOT BOSS PIVOTS


_SECTION_BEGIN("8_PIVOT BOSS PIVOTS");
C1= TimeFrameGetPrice("C", inDaily, -1); // close
H1= TimeFrameGetPrice("H", inDaily, -1); // close
L1= TimeFrameGetPrice("L", inDaily, -1); // close
Today = LastValue(Day());
R4 = H1+(H1-L1);
R3 = H1+(H1-L1)*0.75;
R2 = H1+(H1-L1)*0.50;
R1 = H1+(H1-L1)*0.25;
Pp = ( H1+ L1 + C1 )/3;
S1 = L1-(H1-L1)*0.25;
S2 = L1-(H1-L1)*0.50;
S3 = L1-(H1-L1)*0.75;
S4 = L1-(H1-L1);
BC = (H1+L1)/2;
TC = (Pp-BC)+Pp;
PR = IIf(BC>TC,(BC-TC)*100/TC,(TC-BC)*100/BC);
DPRUP = IIf(BC>TC,BC,TC);
DPRDN = IIf(BC<TC,BC,TC);
_SECTION_END();

_SECTION_BEGIN("PIVOT BOSS PIVOTS CURRENT");


TC1= TimeFrameGetPrice("C", inDaily, 0); // close
TH1= TimeFrameGetPrice("H", inDaily, 0); // close
TL1= TimeFrameGetPrice("L", inDaily, 0); // close
Today = LastValue(Day());
TR4 = TH1+(TH1-TL1);
TR3 = TH1+(TH1-TL1)*0.75;
TR2 = TH1+(TH1-TL1)*0.50;
TR1 = TH1+(TH1-TL1)*0.25;
TPp = ( TH1+ TL1 + TC1 )/3;
TS1 = TL1-(TH1-TL1)*0.25;
TS2 = TL1-(TH1-TL1)*0.50;
TS3 = TL1-(TH1-TL1)*0.75;
TS4 = TL1-(TH1-TL1);
TBC = (TH1+TL1)/2;
TTC = (TPp-TBC)+TPp;
TPR = IIf(TBC>TTC,(TBC-TTC)*100/TTC,(TTC-TBC)*100/TBC);
TDPRUP = IIf(TBC>TTC,TBC,TTC);
TDPRDN = IIf(TBC<TTC,TBC,TTC);
_SECTION_END();

_SECTION_BEGIN("W_PIVOT BOSS PIVOTS");


WC1= TimeFrameGetPrice("C", inWeekly, -1); // close
WH1= TimeFrameGetPrice("H", inWeekly, -1); // close
WL1= TimeFrameGetPrice("L", inWeekly, -1); // close
WR4 = WH1+(WH1-WL1);
WR3 = WH1+(WH1-WL1)*0.75;
WR2 = WH1+(WH1-WL1)*0.50;
WR1 = WH1+(WH1-WL1)*0.25;
WPp = ( WH1+ WL1 + WC1 )/3;
WS1 = WL1-(WH1-WL1)*0.25;
WS2 = WL1-(WH1-WL1)*0.50;
WS3 = WL1-(WH1-WL1)*0.75;
WS4 = WL1-(WH1-WL1);
WBC = (WH1+WL1)/2;
WTC = (WPp-WBC)+WPp;
WPR = IIf(WBC>WTC,(WBC-WTC)*100/WTC,(WTC-WBC)*100/WBC);
WDPRUP = IIf(WBC>WTC,WBC,WTC);
WDPRDN = IIf(WBC<WTC,WBC,WTC);
_SECTION_END();

_SECTION_BEGIN("W_PIVOT BOSS PIVOTS CURRENT");


WTC1= TimeFrameGetPrice("C", inWeekly, 0); // close
WTH1= TimeFrameGetPrice("H", inWeekly, 0); // close
WTL1= TimeFrameGetPrice("L", inWeekly, 0); // close
WTR4 = WTH1+(WTH1-WTL1);
WTR3 = WTH1+(WTH1-WTL1)*0.75;
WTR2 = WTH1+(WTH1-WTL1)*0.50;
WTR1 = WTH1+(WTH1-WTL1)*0.25;
WTPp = ( WTH1+ WTL1 + WTC1 )/3;
WTS1 = WTL1-(WTH1-WTL1)*0.25;
WTS2 = WTL1-(WTH1-WTL1)*0.50;
WTS3 = WTL1-(WTH1-WTL1)*0.75;
WTS4 = WTL1-(WTH1-WTL1);
WTBC = (WTH1+WTL1)/2;
WTTC = (WTPp-WTBC)+WTPp;
WTPR = IIf(WTBC>WTTC,(WTBC-WTTC)*100/WTTC,(WTTC-WTBC)*100/WTBC);
WTDPRUP = IIf(WTBC>WTTC,WTBC,WTTC);
WTDPRDN = IIf(WTBC<WTTC,WTBC,WTTC);
_SECTION_END();

_SECTION_BEGIN("EXPLORATION");
NH = Ref(H,1);
NL = Ref(L,1);
RNG = Ref(H,1) - Ref(L,1);
RNGP = RNG*100/NL;
HP = TDPRDN > DPRUP;
LP = TDPRUP < DPRDN;
IP = TDPRUP < DPRUP AND TDPRDN > DPRDN;
WHP = WTDPRDN > WDPRUP;
WLP = WTDPRUP < WDPRDN;
WIP = WTDPRUP < WDPRUP AND WTDPRDN > WDPRDN;
MMA = C > EMA(C,20);
MMB = C < EMA(C,20);

Filter = DR < CM AND C > 100; // (DR <= CM AND C > 100 AND C < 500000 AND DR/CM >0)
OR (DR1 <= CM1 AND C > 100 AND C < 500000 AND DR1/CM1 >0) OR (DR >= EX AND C > 100
AND C < 500000) OR (DR1 >= EX1 AND C > 100 AND C < 500000 );
AddColumn(C,"CMP",1.2);
AddColumn(DR,"1DR",1.2);
AddColumn(CM,"10DR0.65",1.2);
AddColumn(DR/CM,"RATIO_CONT",1.2);
AddColumn(DR<=CM,"DR<CM",1.2);
AddColumn(CM, "1st tgt addon", 1.2);
AddColumn(ADR10 * 0.75, "2nd tgt addon", 1.2);
AddColumn(ADR10 * 1, "3rd tgt addon", 1.2);
AddColumn(ADR10 * 1.25, "4th tgt addon", 1.2);

_SECTION_END();

You might also like