Dear Friends
This is wavetrend formula.I want to ad one rule for buy sell.
Rule for Buy: Wavetrend1 cross "0" AND if buy , when prices increased 0.5% .If dont increades 0.5 and more dont buy
Rule for Sell: "0" cross wavetrend 1 AND if sell ,when price decreased 0.5% .If dont decreased 0.5% and more dont sell
How to add this rules ?
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
SetChartBkGradientFill(ParamColor("Upper Chart",colorDarkGrey),ParamColor("Lower Chart",colorDarkGrey));
GraphXSpace = Param("GraphXSpace",7,0,20,0.5);
_SECTION_BEGIN("WaveTrend");
OptimizerSetEngine("cmae");
Period = Param( "Period", 10, 1, 200, 1 ); // Channel periods default is 10.
AvgPeriod = Param ( "AvgPeriod", 20, 1, 200, 1 ); // Average periods default is 21.
Period = Optimize ( "Period", 10, 1, 200, 1 ); // Channel periods default is 10.
AvgPeriod = Optimize( "AvgPeriod", 20, 1, 200, 1 ); // Average periods default is 21.
AP = Avg; // Typical Price = ( High + Low + Close ) / 3
ESA = Wilders(AP, Period);
D = Wilders(abs(AP - ESA), Period);
CI = (AP - ESA) / (0.015 * D);
WaveTrend1 =EMA(CI, AvgPeriod); // Gold Color ( BUY )
WaveTrend2 = MA(WaveTrend1,4); // Turquoise Color ( SELL )
Plot(WaveTrend1,"WaveTrend1",colorGold,styleDots | styleThick);
Plot(WaveTrend2,"WaveTrend2",colorTurquoise,styleDots);
Buy=Cross(Wavetrend1,0);
Sell = Cross(0, Wavetrend1);
//Buy=Cross(Wavetrend1,-60)OR Cross(Wavetrend1,-40) OR Cross(Wavetrend1,-20) OR Cross(Wavetrend1,0) OR Cross(Wavetrend1,20) OR Cross(Wavetrend1,40) OR Cross(Wavetrend1,60);
//Sell = Cross(60, Wavetrend1)OR Cross(40, Wavetrend1)OR Cross(20, Wavetrend1)OR Cross(0, Wavetrend1)OR Cross(-20, Wavetrend1)OR Cross(-40, Wavetrend1)OR Cross(-60, Wavetrend1);
Short=Sell;
Cover=Buy;
Plot(0,"",colorBlue,styleNoLabel);
Plot( -60 , "", colorGreen,styleDashed);
Plot( -50 , "", colorGreen,styleDashed);
Plot( 50 , "", colorRed,styleDashed);
Plot( 60 , "", colorRed,styleDashed);
_SECTION_END();
Title=EncodeColor(colorYellow)+ Name()+ EncodeColor(colorLime) +" Wavetrend " + EncodeColor(colorPaleTurquoise) +"(" +Period+ ") = " + EncodeColor(colorWhite) + WaveTrend1;
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoLabel;
bbt = BBandTop( P, Periods, Width );
bbb = BBandBot( P, Periods, Width );
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, colorDarkGrey, 0.9 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();
This is wavetrend formula.I want to ad one rule for buy sell.
Rule for Buy: Wavetrend1 cross "0" AND if buy , when prices increased 0.5% .If dont increades 0.5 and more dont buy
Rule for Sell: "0" cross wavetrend 1 AND if sell ,when price decreased 0.5% .If dont decreased 0.5% and more dont sell
How to add this rules ?
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
SetChartBkGradientFill(ParamColor("Upper Chart",colorDarkGrey),ParamColor("Lower Chart",colorDarkGrey));
GraphXSpace = Param("GraphXSpace",7,0,20,0.5);
_SECTION_BEGIN("WaveTrend");
OptimizerSetEngine("cmae");
Period = Param( "Period", 10, 1, 200, 1 ); // Channel periods default is 10.
AvgPeriod = Param ( "AvgPeriod", 20, 1, 200, 1 ); // Average periods default is 21.
Period = Optimize ( "Period", 10, 1, 200, 1 ); // Channel periods default is 10.
AvgPeriod = Optimize( "AvgPeriod", 20, 1, 200, 1 ); // Average periods default is 21.
AP = Avg; // Typical Price = ( High + Low + Close ) / 3
ESA = Wilders(AP, Period);
D = Wilders(abs(AP - ESA), Period);
CI = (AP - ESA) / (0.015 * D);
WaveTrend1 =EMA(CI, AvgPeriod); // Gold Color ( BUY )
WaveTrend2 = MA(WaveTrend1,4); // Turquoise Color ( SELL )
Plot(WaveTrend1,"WaveTrend1",colorGold,styleDots | styleThick);
Plot(WaveTrend2,"WaveTrend2",colorTurquoise,styleDots);
Buy=Cross(Wavetrend1,0);
Sell = Cross(0, Wavetrend1);
//Buy=Cross(Wavetrend1,-60)OR Cross(Wavetrend1,-40) OR Cross(Wavetrend1,-20) OR Cross(Wavetrend1,0) OR Cross(Wavetrend1,20) OR Cross(Wavetrend1,40) OR Cross(Wavetrend1,60);
//Sell = Cross(60, Wavetrend1)OR Cross(40, Wavetrend1)OR Cross(20, Wavetrend1)OR Cross(0, Wavetrend1)OR Cross(-20, Wavetrend1)OR Cross(-40, Wavetrend1)OR Cross(-60, Wavetrend1);
Short=Sell;
Cover=Buy;
Plot(0,"",colorBlue,styleNoLabel);
Plot( -60 , "", colorGreen,styleDashed);
Plot( -50 , "", colorGreen,styleDashed);
Plot( 50 , "", colorRed,styleDashed);
Plot( 60 , "", colorRed,styleDashed);
_SECTION_END();
Title=EncodeColor(colorYellow)+ Name()+ EncodeColor(colorLime) +" Wavetrend " + EncodeColor(colorPaleTurquoise) +"(" +Period+ ") = " + EncodeColor(colorWhite) + WaveTrend1;
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoLabel;
bbt = BBandTop( P, Periods, Width );
bbb = BBandBot( P, Periods, Width );
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, colorDarkGrey, 0.9 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();