_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("10min Earth");
tf=Param("Time Frame (min)",10,1,10,1);tfrm=in1Minute*tf;
TimeFrameSet(tfrm);
VarT2 = ( High + Low + Close * 2 ) / 4;
BT2 = (EMA((VarT2 - LLV(VarT2,15))/(HHV(Low, 15) - LLV(VarT2, 15)), 2)) * 38;
BotT2 = (((-1)) * (EMA( (VarT2- LLV(VarT2,15) ) / (HHV(Low, 15)-LLV(VarT2, 15)), 2) + 0.01)) * 38;
Var2T2 = ((Close-LLV(Low, 10))/(HHV(High, 10)-LLV(Low, 10))) * 100;
Var3T2 = EMA(Var2T2, 10);
Var4T2 = EMA(Var3T2, 10);
Var5T2 = 3 * Var3T2 - 2 * Var4T2;
Var6T2 = EMA(Var5T2, 5);
BridgeT2 = EMA(Var6T2, 1);
TimeFrameRestore() ;
BridgeT2f = TimeFrameExpand(BridgeT2, tfrm);
myc2ef=IIf(BridgeT2f > Ref(BridgeT2f, -2),colorBlue,
IIf(BridgeT2f < Ref(BridgeT2f, -2),colorRed,31));
Plot(6, "ribbon", myc2ef, styleOwnScale | styleArea|styleNoLabel, 0.1, 100);
_SECTION_END();
_SECTION_BEGIN("Earth-2");
VAR2=(High+Low+(Close)*(2))/(4);
B = ((EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))*(38));
bot1 = ((((-1))*(EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))+0.01)*(38));
VAR22=((Close-LLV(Low,10))/(HHV(High,10)-LLV(Low,10)))*(100);
VAR33=EMA(VAR22,10);
VAR44=EMA(VAR33,10);
VAR55=(3)*(VAR33)-(2)*(VAR44);
VAR66=EMA(VAR55,5);
BridgeT = (EMA(VAR66,1));
myc=IIf(BridgeT > Ref(BridgeT, -1),colorBlue,
IIf(BridgeT < Ref(BridgeT, -1),colorRed,31));
_SECTION_END();
_SECTION_BEGIN("supp");
("Price");
RSIperiod = 15; // Param("RSI p",3,14,30,1);
Percent = 5; // Param("ZIG %",8,9,15,1);
EMAperiod = 5; //Param("EMA p",4,5,10,1);
HHVperiod = 8; //Param("HHV p",3,5,10,1);
NumLine = 2; //Param("Num Lines",3,1,20,1);
Base = DEMA(RSI(RSIperiod),EMAperiod);
GraphXSpace=0.5;
for( i = 1; i <= numline; i++ )
{
ResBase = LastValue(Peak(Base,Percent,i));
SupBase = LastValue(Trough(Base,Percent,i));
Plot(ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), "Resist Level", colorRed, styleLine);
Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen, styleLine);
}
_SECTION_END();
/*
BuySetupValue = ValueWhen( ResBase==Base, HHV(H,HHVperiod) );
SellsetupValue= ValueWhen( supbase==Base, LLV(L,HHVperiod) );
Buysetup = ResBase;
Sellsetup = SupBase;
Lg = Flip(Buysetup,Sellsetup);
st = Flip(Sellsetup,Buysetup);
Buy =(Lg AND Cross(C,BuySetupValue));
Sell =sellsetup;
Short=(st AND Cross(SellsetupValue,C));
Cover= Buysetup;
*/
Buy = C>O AND (BridgeT > Ref(BridgeT, -1)) AND (BridgeT2f > Ref(BridgeT2f, -2));
Sell = (BridgeT2f < Ref(BridgeT2f, -2));
Short = C<O AND (BridgeT < Ref(BridgeT, -1)) AND (BridgeT2f < Ref(BridgeT2f, -2));
Cover = (BridgeT2f > Ref(BridgeT2f, -2));
Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);
PlotShapes(Buy*shapeUpArrow,colorBlue,0,L,-42);
//PlotShapes(Sell*shapeHollowSmallDownTriangle,colorPink,0,L,-51);
PlotShapes(Short*shapeDownArrow,colorRed,0,H,-42);
//PlotShapes(Cover*shapeHollowSmallUpTriangle,colorSkyblue,0,H,-51);