Skip to main content

Ideal Sell Signal for Amibroker (AFL)

npcd_27 almost 14 years ago Amibroker (AFL)

  • Rating:
    2 / 5 (Votes 8)
  • Tags:
    trading system, amibroker

This is one of my favorite indicators. Hope this will be useful for your trading.
Email me at npcd_27@yahoo.com if you find something wrong with this code.

Screenshots

Indicator / Formula

Copy & Paste Friendly
UpClose = Close - Ref(Close,-1); 
Color = IIf(UpClose > 0, colorGreen, colorRed); 
PlotOHLC(Open,High,Low,Close,"", Color, styleCandle);

periods=Param("Periods", 8, 2, 200, 1 );

sellbubble=IIf(PDI(periods)>=30 AND 
ADX(periods)>=35 AND 
ADX(periods)>=PDI(periods) AND 
PDI(periods)> MDI(periods) AND 
Ref(PDI(periods),-1)> Ref(MDI(periods),-1) AND 
ADX(periods)<=Ref(ADX(periods),-1) AND 
Ref(ADX(periods),-1)>=Ref(ADX(periods),-2) AND 
Close<=Open AND 
C<=Ref(C,-1)
,1,0);
Sell=sellbubble;

sb=sellbubble;


PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,H, Offset=-15);

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoLabel;
Plot( bbt = BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( bbb = BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style ); 
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, colorWhite, 0.9 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();

_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("Volume At Price");
PlotVAPOverlay( Param("Lines", 300, 100, 1000, 1 ), Param("Width", 5, 1, 100, 1 ), ParamColor("Color", colorCycle ), ParamToggle("Side", "Left|Right" ) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );
 
_SECTION_END();

_SECTION_BEGIN("Volume1");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick, maskHistogram  ), 2 );
_SECTION_END();

_SECTION_BEGIN("MA2");
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();

_SECTION_BEGIN("MA3");
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();

_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorLavender ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram  ), 2 );
_SECTION_END();

_SECTION_BEGIN("MA1");
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();

9 comments

almost 14 years ago

if we take same logic as buy, then, adding below code with given code, can give buy signal also..
AFTER (PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,H, Offset=-15); )…. COPE-PASTE THIS….

buybubble=IIf(MDI(periods)>=30 AND 
ADX(periods)>=35 AND 
ADX(periods)>=MDI(periods) AND 
MDI(periods)> PDI(periods) AND 
Ref(PDI(periods),-1)< Ref(MDI(periods),-1) AND 
ADX(periods)<=Ref(ADX(periods),-1) AND 
Ref(ADX(periods),-1)>=Ref(ADX(periods),-2) AND 
Close>=Open AND 
C>=Ref(C,-1)
,1,0);
Buy=buybubble;

bb=buybubble;
PlotShapes(IIf(Buy==1, shapeUpArrow, shapeNone), colorBrightGreen, 0,L, Offset=-15);


4. sajid
almost 14 years ago

PLEASE PROVIDE BUY SIGNAL ALSO

ADDDING ABOVE ( debashisshome) NOT WORKING,, OR MAY BE I AM UNABLE TO ADD PROPERLY.

almost 14 years ago

Who faces trouble with debashisshome’s buy formula please use my modification ,It must work .and thnks npcd-27 and debashish for great code, and tweaks respectively

buybubble=IIf(MDI(periods)>=30 AND 
ADX(periods)>=35 AND 
ADX(periods)>=MDI (periods)AND 
MDI(periods)> PDI (periods)AND 
Ref(PDI(periods),-1)< Ref(MDI(periods),-1) AND 
ADX(periods)<=Ref(ADX(periods),-1) AND 
Ref(ADX(periods),-1)>=Ref(ADX(periods),-2) AND 
Close>=Open AND 
C>=Ref(C,-1)
,1,0);
Buy=buybubble;

bb=buybubble;
PlotShapes(IIf(Buy==1, shapeUpArrow, shapeNone), colorBrightGreen, 0,L, Offset=-15);
6. sajid
almost 14 years ago

STIL GIVE ERROR ,, PLEASE ANY ONE PUT BUY CODE PROPERLY ,, IT WILL BECOME GOOD SYSTEM

almost 14 years ago

dont know why u all get error ! its working fine on my ami. anyway try it on a NEW formula editor :-

UpClose = Close - Ref(Close,-1); 
Color = IIf(UpClose > 0, colorBlue, colorWhite); 
PlotOHLC(Open,High,Low,Close,"", Color, styleCandle);

periods=Param("Periods", 8, 2, 200, 1 );

sellbubble=IIf(PDI(periods)>=30 AND 
ADX(periods)>=35 AND 
ADX(periods)>=PDI(periods) AND 
PDI(periods)> MDI(periods) AND 
Ref(PDI(periods),-1)> Ref(MDI(periods),-1) AND 
ADX(periods)<=Ref(ADX(periods),-1) AND 
Ref(ADX(periods),-1)>=Ref(ADX(periods),-2) AND 
Close<=Open AND 
C<=Ref(C,-1)
,1,0);
Sell=sellbubble;

sb=sellbubble;


PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorBlack, 0,H, Offset=-15);
buybubble=IIf(MDI(periods)>=30 AND 
ADX(periods)>=35 AND 
ADX(periods)>=MDI(periods) AND 
MDI(periods)> PDI(periods) AND 
Ref(PDI(periods),-1)< Ref(MDI(periods),-1) AND 
ADX(periods)<=Ref(ADX(periods),-1) AND 
Ref(ADX(periods),-1)>=Ref(ADX(periods),-2) AND 
Close>=Open AND 
C>=Ref(C,-1)
,1,0);
Buy=buybubble;

bb=buybubble;
PlotShapes(IIf(Buy==1, shapeUpArrow, shapeNone), colorBlack, 0,L, Offset=-15);
9. vole_00
almost 14 years ago

This post is copied right from forum:
http://srsc.com.vn/forum/ami-codes/5714-srsc_bubble-code-ami.html#post7279

Thanks all

Leave Comment

Please login here to leave a comment.