AFL Turtle Soup plus one
Here's an AFL to plot horizontal lines at 10 day high and 10 day low. By right clicking on the parameters window and adjusting the value, one can plot lines for any duration. This will visually help to scan the Turtle Soup plus one strategy mentioned. Special thanks to Anant (Asnavale) for taking the time to develop this AFL.
//******** The AFL starts here *************
_SECTION_BEGIN("N_Day_HiLo");
// Set chart display parameters
// Chart background is Black,
// Date Axis displayed,
// Long titles wrapped to next line
SetChartOptions(0, chartShowDates | chartWrapTitle);
SetChartBkColor(colorBlack);
// Locate Highest HIGH and Lowest LOW in last N days
N = Param("Days to go back(Excl today)", 10, 2, 200, 1);
PriceStyle = ParamStyle("Chart Type", styleCandle, maskPrice);
LineStyle = ParamStyle("Line Style");
NDayHi = H[BarCount - 1 - N];
NDayLo = L[BarCount - 1 - N];
XH = XL = BarCount - 1 - N;
for(i = BarCount - 1 - N; i < BarCount - 1; i++)
{
if(H > NDayHi)
{
NDayHi = H;
XH = i;
}
if(L < NDayLo)
{
NDayLo = L;
XL = i;
}
}
// Define the Lines to be drawn
HLine = LineArray(BarCount - 1 - N, NDayHi, BarCount - 2, NDayHi);
LLine = LineArray(BarCount - 1 - N, NDayLo, BarCount - 2, NDayLo);
// Plot chart
_N(Title = StrFormat("{{NAME}} ({{INTERVAL}}) {{DATE}} {{OHLCX}} Vol=%1.0f\n{{VALUES}}", V));
Plot(C, "", colorGrey50, PriceStyle);
Plot(Hline, WriteVal(N, 1.0) + " Day Hi", colorBrightGreen, LineStyle);
Plot(LLine, WriteVal(N, 1.0) + " Day Lo", colorYellow, LineStyle);
_SECTION_END();
//************ END of AFL ***************