Got the Error 31 in BUY AND SELL function. Struggling to find the solution. Please help me to sort-out the issue.
_SECTION_BEGIN("chart basic Candle stick ");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
if (SetBarFillColor( IIf( (C < O) AND (C < Ref( C, -1)), colorRed, colorGreen ) ) );
else
(SetBarFillColor( IIf( (C > O)AND (C < Ref( C, -1)), colorWhite,colorWhite)));
Plot( C, "Close",IIf( Close < Ref( Close, -1), colorRed, colorGreen ), styleCandle );
_SECTION_END();
_SECTION_BEGIN("ADX");
range = Param("Periods", 14, 2, 200, 1 );
Plot(ADX(14), _DEFAULT_NAME(), ParamColor( "ADX color", colorBlue ), ParamStyle("ADX style", styleThick ) );
_SECTION_END();
_SECTION_BEGIN("ADXR");
periods = Param("Periods", 14, 2, 300, 1);
ADXR = (ADX(14) + Ref(ADX(14), -14))/2;
Color = ParamColor("Color", colorCycle);
Style = ParamStyle("Style");
Plot(ADXR, _DEFAULT_NAME(), Color, Style);
_SECTION_END();
_SECTION_BEGIN("RSI");
SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 200, 1 );
Plot(RSI(14), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("Stochastic %D");
periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
Plot( StochD(5,3,3), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("Stochastic %K");
periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Plot( StochK(5,3), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
Buy = ADX > 25 AND ADX > ADXR AND ADX > Ref(ADX,-1) AND ADXR > Ref(ADXR,-1) AND RSI > 50 AND Cross(StochK, StochD);
Sell = ADX > 25 AND ADX > ADXR AND ADX > Ref(ADX,-1) AND ADXR > Ref(ADXR,-1) AND RSI < 50 AND Cross(StochD, StochK);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite,0,Low,Offset=-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorWhite,0,High,Offset=-15);
_SECTION_END();
_SECTION_BEGIN("chart basic Candle stick ");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
if (SetBarFillColor( IIf( (C < O) AND (C < Ref( C, -1)), colorRed, colorGreen ) ) );
else
(SetBarFillColor( IIf( (C > O)AND (C < Ref( C, -1)), colorWhite,colorWhite)));
Plot( C, "Close",IIf( Close < Ref( Close, -1), colorRed, colorGreen ), styleCandle );
_SECTION_END();
_SECTION_BEGIN("ADX");
range = Param("Periods", 14, 2, 200, 1 );
Plot(ADX(14), _DEFAULT_NAME(), ParamColor( "ADX color", colorBlue ), ParamStyle("ADX style", styleThick ) );
_SECTION_END();
_SECTION_BEGIN("ADXR");
periods = Param("Periods", 14, 2, 300, 1);
ADXR = (ADX(14) + Ref(ADX(14), -14))/2;
Color = ParamColor("Color", colorCycle);
Style = ParamStyle("Style");
Plot(ADXR, _DEFAULT_NAME(), Color, Style);
_SECTION_END();
_SECTION_BEGIN("RSI");
SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 200, 1 );
Plot(RSI(14), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("Stochastic %D");
periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
Plot( StochD(5,3,3), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("Stochastic %K");
periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Plot( StochK(5,3), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
Buy = ADX > 25 AND ADX > ADXR AND ADX > Ref(ADX,-1) AND ADXR > Ref(ADXR,-1) AND RSI > 50 AND Cross(StochK, StochD);
Sell = ADX > 25 AND ADX > ADXR AND ADX > Ref(ADX,-1) AND ADXR > Ref(ADXR,-1) AND RSI < 50 AND Cross(StochD, StochK);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite,0,Low,Offset=-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorWhite,0,High,Offset=-15);
_SECTION_END();
Attachments
-
2.1 KB Views: 137