SetChartOptions(0, chartShowDates | chartWrapTitle);
SetChartBkColor( ParamColor("Chart Color", colorGrey40));
/********************/
/* */
/* Quadra Pivots */
/* */
/********************/
Pivot = (2 * O + H + L) / 4;
R2 = 2 * Pivot - L;
R4 = Pivot + (H - L);
R3 = (R2 + R4) / 2;
R1 = (Pivot + R2) / 2;
S2 = 2 * Pivot - H;
S4 = Pivot - (H - L);
S3 = (S2 + S4) / 2;
S1 = (Pivot + S2) / 2;
/********************/
/* */
/* Wilder's MAs */
/* */
/********************/
A1 = Wilders(C, 5);
A2 = Wilders(C, 8);
A3 = Wilders(C, 13);
A4 = EMA(C, 50);
/********************/
/* */
/* Candle Color */
/* */
/********************/
Green = C > O;
Red = C < O;
for(i = 1; i<BarCount; i++)
{
if(C[i] == O[i])
{
if(Green[i - 1] AND C[i] >= C[i - 1]) Green[i] = 1;
if(Red[i - 1] AND C[i] <= C[i - 1]) Red[i] = 1;
}
}
/********************/
/* */
/* BUY/SELL */
/* */
/********************/
//slope50=tan(A4);
Buy = (A1 > A2 AND A2 > A3);// AND slope50 > 0);
Sell =(A1 < A2 AND A2 < A3);
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Marker = Buy * shapeUpArrow + Sell * shapeDownArrow;
MarkerColor = IIf(Buy, colorBrightGreen, colorYellow);
MarkerDist = IIf(Buy, 0.995 * L, 1.005 * H);
EMA_Position = IIf(A4 > A3 AND A4 > A2 AND A4 > A1, 1, IIf(A4 < A3 AND A4 < A2 AND A4 < A1, -1, 0));
/********************/
/* */
/* Arrows Option */
/* */
/********************/
Arrows = ParamToggle("Show Arrows", "NO|YES");
_N(Title = StrFormat("{{NAME}}({{INTERVAL}}, {{DATE}} : {{OHLCX}}, Vol=%1.0f\n{{VALUES}} ", V)
//+ " EMA50 Slope : " + slope50
+ EncodeColor(colorPink) + " EMA50 location: " + EncodeColor(colorBrightGreen) + WriteIf(EMA_Position > 0, "Above, ", "")
+ EncodeColor(colorLightGrey) + WriteIf(EMA_Position == 0, "Inside, ", "")
+ EncodeColor(colorRed) + WriteIf(EMA_Position < 0, "Below, ", "")
+ EncodeColor(colorBrightGreen) + WriteIf(Green, " Green Candle", "") + EncodeColor(colorRed) + WriteIf(Red, " RedCandle\n\n", "\n\n")
+ EncodeColor(colorWhite) + WriteIf(Buy, "Buy Above " + H, "") + WriteIf(Sell, "Sell Below " + L, "")
+ EncodeColor(colorYellow)
+ StrFormat("\n\nPivot = %6.2f\nR1 = %6.2f, S1 = %6.2f\nR2 = %6.2f, S2 = %6.2f\nR3 = %6.2f, S3 = %6.2f\nR4 = %6.2f, S4 = %6.2f", Pivot, R1, S1, R2, S2, R3, S3, R4, S4));
if(Status("action") == actionIndicator)
{
Plot(A4, "EMA50", colorLightGrey, styleLine | styleThick);
Plot(A3, "Wilder MA13", colorRed, styleLine);
Plot(A2, "Wilder MA8", colorLightOrange, styleLine);
Plot(A1, "Wilder MA5", colorBrightGreen, styleLine);
Plot(C, "", IIf(Green, colorGreen, IIf(Red, colorRed, colorGrey50)), styleCandle);
if(Arrows) PlotShapes(Marker, MarkerColor, 0, MArkerDist);
}
if(Status("action") == actionExplore)
{
Filter = Buy OR Sell;
SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "SYMBOL");
AddColumn(DateTime(), "DATE", formatDateTime);
AddColumn(IIf(Buy, 66, 83), "TRIGGER", formatChar, colorWhite, IIf(Buy, colorGreen, colorRed));
AddColumn(EMA_Position, "EMA Position",1.0);
AddColumn(IIf(Buy, H, L), "TRIG PRICE", 1.2);
AddColumn(C, "Last Close", 1.2);
}