PureBytes Links
Trading Reference Links
|
Hello,
Plot daily , weekly , Monthly moving averages without changing period
setting. Load into indicator builder, click apply,
/*****Version UPDATE *******/
//Now includes current Partial Month and Week values
/******************************************************/
//Plot Monthly, Weekly and Daily Moving Average on Daily Price Chart
MaxGraph=7;
//Input Time periods for Monthly,Weekly and Daily Moving Averages
MonthlyPds=10;//Months
WeeklyPds=20;//Weeks
DailyPds=10;//Days
/***********************************/
//Input Price Variable ( open, high ,low, close);
Price=C;
MonthlyPrice=Price;
WeeklyPrice=Price;
DailyPrice=Price;
/**********************************/
/***Colors***/
//Set to your Preference
Color=6;//Price chart
MthAvgColor=3;//Monthly AverageLine
WklyAvgColor=5;//weekly AverageLine
DlyAvgColor=4;//Daily AverageLine
/**********************************/
LastBar = Cum(1)==LastValue(Cum(1));
Weekly=ValueWhen(DayOfWeek() > Ref( DayOfWeek(),1)OR Lastbar
,WeeklyPrice);
Monthly=ValueWhen(Day() > Ref( Day(), 1 ) OR LastBar,MonthlyPrice);
MonthlyAvg=EMA(Monthly,MonthlyPds);
WeeklyAvg=EMA(Weekly,WeeklyPds);
DailyAvg=EMA(DailyPrice,DailyPds);
Graph0=C;
Graph0Style=64;
Graph0Color=Color;
Graph1=WeeklyAvg;
Graph1Style=1+4;//Thick line
Graph1Color=WklyAvgColor;
Graph2=DailyAvg;
Graph2Style=1;
Graph2Color=DlyAvgColor;
Graph3=MonthlyAvg;
Graph3Style=1;
Graph3Color=MthAvgColor;
Title=Name()+" "+"("+WriteVal(WeeklyPds,1)+")"+" Week Moving Average=
"+"("+WriteVal(WeeklyAvg,1.2)+")"+" :: "+"("+WriteVal(DailyPds,1)+")"+"
Period Moving Average= "+"("+WriteVal(DailyAvg,1.2)+")"+" ::
"+"("+WriteVal(MonthlyPds,1)+")"+" Month Moving Average=
"+"("+WriteVal(MonthlyAvg,1.2)+")";
|