Strategy Plateau

This is the place to discuss EdgeRater Chart Script

Moderator: Chris White

Post Reply
bsegura
Posts: 32
Joined: Tue Jan 12, 2021 11:56 am

Strategy Plateau

Post by bsegura »

Below is a Strategy Plateau that is loosely based on the Turtle Strategy for 20 periods




range := abs(high - low);

x1 := close>open & range != 0;
x2 := (range/(2*Range+Open-Close)) * V;

x3 := close<open & range !=0;
x4 := ((range+close-open)/(2*Range+close-open)) * V;

x5 := close==open;
x6 := 0.5 * V;

value1 := if(x1,x2,if(x3,x4,if(x5,x6,nan)));
value2 := v - value1;

value3 := abs(value1 + value2);
value4 := value1 * range;
value5 := (value1-value2)*range;
value6 := value2*range;
value7 := (value2-value1)*range;

value8 := if(range != 0,value1/range,nan);
value9 := if(range != 0,(value1-value2)/range,nan);
value10 := if(range != 0,value2/range,nan);
value11 := if(range != 0,(value2-value1)/range,nan);
value12 := if(range != 0, value3/range,nan);

use2bars := 0;

value13 := if (use2bars,value3-value3[1],nan);
value14 := if (use2bars,(value1+value1[1])*hhv(h,2)-llv(l,2),nan);
value15 := if (use2bars,(value1+value1[1]-value2-value2[1])*(hhv(h,2)-llv(l,2)),nan);
value16 := if (use2bars,(value2+value2[1])*(hhv(h,2)-llv(l,2)),nan);
value17 := if (use2bars,(value2+value2[1]-value1-value1[1])*(hhv(h,2)-llv(l,2)),nan);
value18 := if (use2bars,(value1+value1[1]-value2-value2[1])/(hhv(h,2)-llv(l,2)),nan);
value19 := if (use2bars,(value1+value1[1]-value2-value2[1])/(hhv(h,2)-llv(l,2)),nan);
value20 := if (use2bars,(value2+value2[1])/(hhv(h,2)-llv(l,2)),nan);
value21 := if (use2bars,(value2+value2[1]-value1-value1[1])/(hhv(h,2)-llv(l,2)),nan);
value22 := if (use2bars,value13/(hhv(h,2)-llv(l,2)),nan);

lookback := 20;

cond1 := value3 == llv(value3, lookback);
cond2 := value4 == hhv(value4, lookback) & c>o;
cond3 := value5 == hhv(value5, lookback) & c>o;
cond4 := value6 == hhv(value6, lookback) & c<o;
cond5 := value7 == hhv(value7, lookback) & c<o;
cond6 := value8 == llv(value8, lookback) & c<o;
cond7 := value9 == llv(value9, lookback) & c<o;
cond8 := value10 == llv(value10,lookback) & c>o;
cond9 := value11 == llv(value11,lookback) & c>o;
cond10 := value12 == hhv(value12,lookback);


cond11 := use2bars==1 & value13 == llv(value13,lookback);
cond12 := use2bars==1 & value14 == hhv(value14,lookback) & c>o & ref(c,1) > ref(o,1);
cond13 := use2bars==1 & value15 == hhv(value15,lookback) & c>o & ref(c,1) > ref(o,1);
cond14 := use2bars==1 & value16 == hhv(value16,lookback) & c<o & ref(c,1) < ref(o,1);
cond15 := use2bars==1 & value17 == hhv(value17,lookback) & c<o & ref(c,1) < ref(o,1);
cond16 := use2bars==1 & value18 == llv(value18,lookback) & c<o & ref(c,1) < ref(o,1);
cond17 := use2bars==1 & value19 == llv(value19,lookback) & c<o & ref(c,1) < ref(o,1);
cond18 := use2bars==1 & value20 == llv(value20,lookback) & c>o & ref(c,1) > ref(o,1);
cond19 := use2bars==1 & value21 == llv(value21,lookback) & c>o & ref(c,1) > ref(o,1);
cond20 := use2bars==1 & value22 == hhv(value22,lookback);

//if bartype>1 then begin
//if lowvol and (cond1 or cond11) then barcolor = LowVolColor
//if ClimaxUp and (cond2 or cond3 or cond8 or cond9 or cond12 or cond13 or cond18 or cond19 then barcolor = climaxUpColor
//if CLimaxDown and (cond4 or cond5 or cond6 or cond7 or cond14 or cond15 or cond16 or cond17 then barcolor - ClimaxDownColor
//if ClimaxChurn and (cond10 or cond20) then barcolor = ChurnColor;
//if ClimaxChurn and (cond10 or cond20) and (cond2 or cond3 or cond4 or cond5 or cond6 or cond7 or cond8 or cond9 or cond12 or cond13 or cond14 or cond15 or cond16 or cond17 or cond18 or cond19) then barcolor = ClimaxChurnColor

LowVol := (cond1 | cond11);
ClimaxUp := (cond2 | cond3 | cond8 | cond9 | cond12 | cond13 | cond18 | cond19);
ClimaxDown := (cond4 | cond5 | cond6 | cond7 | cond14 | cond15 | cond16 | cond17);
Churn := (cond10 | cond20);
ClimaxChurn := (cond10 | cond20) & (cond2 | cond3 | cond4 | cond5 | cond6 | cond7 | cond8 | cond9 | cond12 | cond13 | cond14 | cond15 | cond16 | cond17 | cond18 | cond19);

//Market tops are characterized by Volume Climax Up bars, High Volume Churn and Low Volume Up bars (also called Testing).
//Market bottoms are characterized by Volume Climax Down bars, High Volume Churn and Low Volume Down bars (Testing).
//Pullbacks, in either up or down trends, are similar to market topping or bottoming patterns, but shorter in duration and with simpler volume patterns.

// bottom -------------- volume climax down---high volume churn-----high vol churn + climax-----low volume
// orange green/blue magenta yellow

//start uptrend -------- volume climax up
// red

// uptrend continue ---- volume climax down-----low volume
// orange yellow

// top ----------------- volume climax up-----high volume churn-----high vol churn + climax-----low volume
// red green/blue magenta yellow

// start down trend ---- volume climax down
// white

// downtrend continue -- volume climax up------low volume
// red yellow


// ClimaxChurn = Putting on the brakes before the big event

no_cond := !(lowvol) & !(climaxup) & !(climaxdown) & !(churn) & !(climaxchurn);



hma55 := hullma(close,55);
hma55v := hullma(value3,55);


wr:= -100*(HHV(HIGH,18)-CLOSE)/(HHV(HIGH,18)-LLV(LOW,18));


// this is cool - worth being a strategy on it own
// wait and buy when first occurance of no (wr<-90)
//event: climaxUp & wr<-90



d3 := close<ref(close,1) & close<ref(close,2) & close<ref(close,3) & close<ref(close,4) & close<ref(close,5) & close<ref(close,6) & close<ref(close,7) & close<ref(close,8) & close<ref(close,9) & close<ref(close,10);


event1 := climaxchurn & close<open & D3;
event2 := ((((ref(climaxUp,5) & ref(wr,5)<-90) | (ref(climaxUp,4) & ref(wr,4)<-90) | (ref(climaxUp,3) & ref(wr,3)<-90) | (ref(climaxUp,2) & ref(wr,2)<-90) | (ref(climaxUp,1) & ref(wr,1)<-90)) & (ref(wr,1)<-90 & wr>-90)));
event3:= climaxchurn;
trigger:= if (event1 | event2 | event3,1,0);

//B: VALUEWHEN(CLOSE,trigger),colorblue,width2,pointdot;

//FILLRGN(close>B,close,B),Brush#A000090;
//FILLRGN(close>B,close,B),Brush#A000090;
//FILLRGN(close>B,close,B),Brush#A000090;





d1 := close>ref(close,1) & close>ref(close,2) & close>ref(close,3) & close>ref(close,4) & close>ref(close,5) & close>ref(close,6) & close>ref(close,7) & close>ref(close,8) & close>ref(close,9) & close>ref(close,10);
d1a := close>ref(close,1) & close>ref(close,2) & close>ref(close,3) & close>ref(close,4) & close>ref(close,5) & close>ref(close,6) & close>ref(close,7) & close>ref(close,8) & close>ref(close,9) & close>ref(close,10);

d3 := close<ref(close,1) & close<ref(close,2) & close<ref(close,3) & close<ref(close,4) & close<ref(close,5) & close<ref(close,6) & close<ref(close,7) & close<ref(close,8) & close<ref(close,9) & close<ref(close,10);

d2 := close>ref(close,1) & close>ref(close,2) & close>ref(close,3) & close>ref(close,4) & close>ref(close,5) & close>ref(close,6) & close>ref(close,7) & close>ref(close,8) & close>ref(close,9) & close>ref(close,10) & close>ref(close,11) & close>ref(close,12) & close>ref(close,13) & close>ref(close,14) & close>ref(close,15) & close>ref(close,16) & close>ref(close,17) & close>ref(close,18) & close>ref(close,19) & close>ref(close,20);
d4 := close<ref(close,1) & close<ref(close,2) & close<ref(close,3) & close<ref(close,4) & close<ref(close,5) & close<ref(close,6) & close<ref(close,7) & close<ref(close,8) & close<ref(close,9) & close<ref(close,10) & close<ref(close,11) & close<ref(close,12) & close<ref(close,13) & close<ref(close,14) & close<ref(close,15) & close<ref(close,16) & close<ref(close,17) & close<ref(close,18) & close<ref(close,19) & close<ref(close,20);

//trigger2:= if (d2,1,if(!(d4),0,nan));
trigger2:= if (d2,1,0);


B: VALUEWHEN(CLOSE,trigger2),colorRed,width2,pointdot;
//bc: B,colorred;
Bline: VALUEWHEN(CLOSE,trigger2),colorRed;


trigger2a:= if (d4,1,0);
Ba: VALUEWHEN(CLOSE,trigger2a),colorGreen,width2,pointdot;

trigger3:= if (climaxUP,1,0);
//B: VALUEWHEN(CLOSE,trigger3),colorblue,width2,pointdot;

trigger4 := if (B !=nan & ba!=nan & cross(close,hullma(close,55)),1,0);
Bb: VALUEWHEN(CLOSE,trigger4),colorBLUE,width3,pointdot;

//trigger_2 := b != ref(b,1);
//trigger_1 := !(ref(d2,1)) & d2;
//DRAWSHAPE(trigger_2, close, 1,true,0,'square',1,'black', 'orange');


DRAWSHAPE(B<ref(b,1), Ba, 1, true, 0, 'TRIANGLEUP', 2, 'black','black');
DRAWSHAPE(B>ref(b,1), Ba, 1, true, 0, 'TRIANGLEUP', 1.75, 'gray','gray');
DRAWSHAPE(ref(b,2)==ref(b,1) & B>ref(b,1), Ba, 1, true, 0, 'TRIANGLEUP', 2, 'orange','orange');

//DRAWSHAPE(cross(close,hullma(close,55)),1, true, 0, 'DIAMONDVERTICAL',1, 'blue', 'blue');
DRAWSHAPE(cross(close,hullma(close,55)), Ba, 1, true, 0, 'DIAMONDVERTICAL', 1, 'blue','blue');
Post Reply