_SECTION_BEGIN("Market Trend");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}} - Cycle analysis indicator from www.marketcalls.in", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", colorDefault, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
function predictCycle( arg1, arg2 )
{
local var1, var2;
result = arg1 + arg2;
return result;
}
Predict=0;
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Predict = PredictCycle(C,Periods);
Buy = Predict>Ref(Predict,-1);
Sell = Predict<Ref(Predict,-1);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Plot(Predict,"Predict",colorwhite,styleLine | styleThick);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen, 0,L, Offset=-5);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-5);
_SECTION_END();