Hello,
I wanted to know what is wrong in this AFL where arrows are not coming proper in SCAN. There are no BUY Arrows being shown and Multiple SELL arrows are popping up at the WRONG place
Condition:
Buy : Price > 200MA (one candle ago) AND MACDHist > 0 (zero) - on earlier candle, MACDHist was below 0;
Sell : Price < 200MA (one candle ago) AND MACDHist < 0 (zero) - on earlier candle, MACDHist was above 0;
Note: The AFL is for MACD Lines. I'm not sure how to code for MACDHist. Pls modify a bit.
Also requesting addition of line to work in EXPLORE option also
http://imageshack.us/photo/my-images/545/bhartidly.jpg/
_SECTION_BEGIN("Price");
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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("Volume1");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick, maskHistogram ), 2 );
_SECTION_END();
_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
MA_Buy= Cross( C, MA( Close, 200 ) );
MA_Sell= Cross( EMA( Close, 200 ), C );
MACD_Buy = MACD(5,10) > 0;
MACD_Sell = MACD(5,10) < 0;
Buy = MA_Buy AND MACD_Buy == True;
Sell = MA_Sell AND MACD_Sell == True;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
Plot( Close, "Price", colorBlack, styleCandle );
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
GraphXSpace = 5;
Short = Sell;
Cover = Buy;
I wanted to know what is wrong in this AFL where arrows are not coming proper in SCAN. There are no BUY Arrows being shown and Multiple SELL arrows are popping up at the WRONG place
Condition:
Buy : Price > 200MA (one candle ago) AND MACDHist > 0 (zero) - on earlier candle, MACDHist was below 0;
Sell : Price < 200MA (one candle ago) AND MACDHist < 0 (zero) - on earlier candle, MACDHist was above 0;
Note: The AFL is for MACD Lines. I'm not sure how to code for MACDHist. Pls modify a bit.
Also requesting addition of line to work in EXPLORE option also
http://imageshack.us/photo/my-images/545/bhartidly.jpg/
_SECTION_BEGIN("Price");
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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("Volume1");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick, maskHistogram ), 2 );
_SECTION_END();
_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
MA_Buy= Cross( C, MA( Close, 200 ) );
MA_Sell= Cross( EMA( Close, 200 ), C );
MACD_Buy = MACD(5,10) > 0;
MACD_Sell = MACD(5,10) < 0;
Buy = MA_Buy AND MACD_Buy == True;
Sell = MA_Sell AND MACD_Sell == True;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
Plot( Close, "Price", colorBlack, styleCandle );
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
GraphXSpace = 5;
Short = Sell;
Cover = Buy;