_SECTION_BEGIN("EMA");
P=V;
Periods = Param("PeriodsEMA", 100);
Plot( EMA( P, Periods ), _DEFAULT_NAME(), colorBlack, styleLine | styleThick );
_SECTION_END();
// Param( ''name'', defaultval, min, max, step, sincr = 0 )
lookback = Param("Period", 2);
range = H - L;
Value2 = V*range;
Value21= Ref(V,1)*(Ref(H,1)-Ref(L,1));
Value3 = V/range;
Value31= Ref(V,1)/(Ref(H,1)-Ref(L,1));
hival2=Max(Value2,Value21);
hival3=Max(Value3,Value31);
//hival2=HHV(Value21,lookback);
//hival3=HHV(Value31,lookback);
val2cond = (H + L)/2;
Value1=LLV(V,20);
BarColor = IIf((Value1==V), colorGrey50,
IIf( (Value2 == hival2) && (C > val2cond), colorBlue,
IIf( (Value3 == hival3), colorGreen,
IIf( (Value2 == hival2) && (Value3 == hival3), colorPaleTurquoise,
IIf( (Value2 == hival2) && (C <= val2cond), colorRed, colorGrey50)))));
_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), BarColor, ParamStyle( "Style", styleHistogram | styleThick, maskHistogram ), 2 );
_SECTION_END();