// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("market");
r1 =abs((H-C));
Plot( r1, "doubt", ParamColor("doubt  color", colorBlack ), ParamStyle( "Style-doubt", styleHistogram |styleThick, maskHistogram  ) );
r2 = High-Ref(Low,-1);
Plot( r2, "Runaway", ParamColor("Runaway  color", colorWhite ), ParamStyle( "Style-Runaway", styleHistogram |  styleThick, maskHistogram  ) );
r3=((C-O)/2)+O-(((Ref(C,-1)-Ref(O,-1))/2)+Ref(O,-1));

Plot( r3, "Average-versus-yesterday", ParamColor("market-vision  color", colorBlue ), ParamStyle( "Style-market-vision", styleThick,maskHistogram ) );
r4=2*(C-O)+L-H;
Plot( r4, "Buy-offer", ParamColor("Buy-offer color", colorTan ), ParamStyle( "Style-Buy-offer",styleHistogram | styleThick,maskHistogram ) );
baseline=0;
Plot(baseline,"Baseline",colorRed,styleDashed);
RSIperiod	= 14;	// Param("RSI p",3,14,30,1);
Percent 		= 5;	//	Param("ZIG %",8,9,15,1);
EMAperiod 	= 9;	//Param("EMA p",4,5,10,1);
HHVperiod 	= 5;	//Param("HHV p",3,5,10,1);
NumLine 		= 1;	//Param("Num Lines",3,1,20,1);

Base = 0;


for( i = 1; i <= numline; i++ )
{
ResBase = LastValue(Peak(Base,Percent,i));
SupBase = LastValue(Trough(Base,Percent,i));
Plot(ValueWhen( ResBase==Base, HHV(r3 ,HHVperiod) ), "High Price Level(5)", colorYellow, styleThick);
Plot(ValueWhen( supbase==Base, LLV(r3 ,HHVperiod) ), "low Price Level(5)", colorBrightGreen, styleLine);
}

RSIperiod1	= 14;	// Param("RSI p",3,14,30,1);
Percent1 		= 5;	//	Param("ZIG %",8,9,15,1);
EMAperiod1 	= 9;	//Param("EMA p",4,5,10,1);
HHVperiod1 	= 8;	//Param("HHV p",3,5,10,1);
NumLine1 		= 1;	//Param("Num Lines",3,1,20,1);

Base1 = 0;


for( i = 1; i <= numline1; i++ )
{
ResBase1 = LastValue(Peak(Base1,Percent1,i));
SupBase1 = LastValue(Trough(Base1,Percent1,i));
Plot(ValueWhen( ResBase1==Base1, HHV(r3 ,HHVperiod1) ), "High Price Level(8)", colorRose, styleLine);
Plot(ValueWhen( supbase1==Base1, LLV(r3 ,HHVperiod1) ), "low Price Level(8)", colorSkyblue, styleThick);
}
_SECTION_END();
_SECTION_BEGIN("doubt");

Periods = Param("Periods", 14, 2, 200, 1 );
//Plot( MA( r1, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorPink ), ParamStyle("Style-doubt") | styleNoRescale ); 
_SECTION_END();

_SECTION_BEGIN("Runaway");

Periods = Param("Periods", 14, 2, 300, 1 );
Plot( MA( r2, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorYellow ), ParamStyle("Style-Runaway") | styleNoRescale ); 
_SECTION_END();

_SECTION_BEGIN("market-vision");

Periods = Param("Periods", 3, 2, 400, 1 );
//Plot( MA( r3, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorSkyblue ), ParamStyle("Style-market-vision") | styleNoRescale ); 
_SECTION_END();
_SECTION_BEGIN("Background");
	SetChartBkColor(ParamColor("Outer panel",colorYellow)); // color of outer border 
	SetChartBkGradientFill( ParamColor("Inner panel upper",colorLightBlue),ParamColor("Inner panel lower",colorBrown));
	tchoice=Param("Title Selection ",2,1,2,1);
_SECTION_END();