Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

All MA for Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:
amibroker, moving average

This Indicator will plot 6 different MA on the chart that can be turned ON and OFF the styles can be set as per the user requirement

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("All MA");
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 ) ) ));
Styles=ParamStyle("Style");
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | styleLine | GetPriceStyle() );

Toggle10=ParamToggle("SMA-10","ON|OFF",1 );
Toggle20=ParamToggle("SMA-20","ON|OFF",1 );
Toggle50=ParamToggle("SMA-50","ON|OFF",1 );
Toggle100=ParamToggle("SMA-100","ON|OFF",1 );
Toggle200=ParamToggle("SMA-200","ON|OFF",1 );
Toggle450=ParamToggle("SMA-450","ON|OFF",1 );
if(Toggle10)
{
  Plot(MA(Close,10),"MA-10",colorBlue , Styles );
}
if(Toggle20)
{
  Plot(MA(Close,20),"MA-20",colorGreen , Styles );
}
if(Toggle50)
{
  Plot(MA(Close,50),"MA-50",colorRed , styleLine | Styles );
}
if(Toggle100)
{
  Plot(MA(Close,100),"MA-100",41 , styleLine | Styles );
}
if(Toggle200)
{
  Plot(MA(Close,200),"MA-20",39 , styleLine | Styles );
}
if(Toggle450)
{
  Plot(MA(Close,450),"MA-20",15, styleLine | Styles );
}


_SECTION_END();

2 comments

1. tipasda

Will be more good if this afl completely with exploration/scanner sir. Thnak you.

2. hotaro3

Very Simple and good for beginners, I add here a code to draw a different type of MA and not just Different SMA. it is as follows:

//Modified by Bobby Kular email: bobby.kular@yahoo.com
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN(“Background”);
SetChartOptions(0,chartShowArrows|chartShowDates);
priceTitle=StrFormat(“-- {{NAME}} -———- {{VALUES}}”);
Title =“Averages” + priceTitle;

if( ParamToggle(“Tooltip shows”, “All Values|Only Prices” ) )
{
ToolTip=StrFormat("Open: g\nHigh: %g\nLow: %g\nClose: %g (.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC));
}

SetChartBkColor(ParamColor("Outer panel color “,colorBlack)); // color of outer border
SetChartBkGradientFill( ParamColor(”Inner panel color upper half",colorBlack),ParamColor(“Inner panel color lower half”,colorBlack)); // color of inner panel
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN(“Average”);
P = ParamField(“Field”);
Type = ParamList(“Type”, “Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple”);
Periods = Param(“Periods”, 9, 2, 100 );
Displacement = Param(“Displacement”, 1, -50, 50 );
m = 0;

if( Type == “Weighted” ) m= WMA;
if( Type == “Lagless-21” ) m= 2*EMA(P, Periods)-EMA, Periods);
if( Type == “Hull-26” ) m= WMA)-WMA ,4 );
if( Type == “Linear Regression-45” ) m= LinearReg( P, Periods );
if( Type == “Exponential” ) m = EMA;
if( Type == “Double Exponential” ) m = DEMA;
if( Type == “Tripple Exponential” ) m = TEMA;
if( Type == “Wilders” ) m = Wilders( P, Periods );
if( Type == “Simple” ) m = MA;

Plot( m, _DEFAULT_NAME(), ParamColor(“Color”, colorWhite), styleThick, 0, 0, Displacement );

//Plot Price
barcolor = IIf(C > m, ParamColor(“Up Color”,colorBrightGreen), IIf(C ==m,colorRed, ParamColor(“Dn Color”,colorRed)));
Plot( C, “Close”, barcolor, ParamStyle(“Style”,styleThick+styleNoLabel) | GetPriceStyle());

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN(“Price”);
Plot( C, “Close”, ParamColor(“Color”, colorLightOrange ), styleNoLine|styleNoRescale );
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Leave Comment

Please login here to leave a comment.

Back