Dear Tomaz,
This is ATP.afl for Average Traded Price.
========================================
DayChange = Day() != Ref(Day(), -1);
AvgTradePrice = Null;
CurDayBars = 0;
CurDayCloseSum = 0;
for (i = 0; i < BarCount; i++)
{
if (DayChange[i] )
{
CurDayCloseSum = C[i];
CurDayBars = 1;
}
else
{
CurDayCloseSum = CurDayCloseSum + C[i];
CurDayBars++ ;
}
AvgTradePrice[ i] = CurDayCloseSum / CurDayBars;
}
Plot(AvgTradePrice, "ATP" , 55, 1);
PlotShapes(shapeCircle * DayChange, colorBlue, 0, C, 0);
==============================================
There is little error in calculation.
There is Summession of Every closing price in one variable and then deviding No of bars then ATP derrives.But actually it may as under:
The Price may linked with Volume.
A=Price*Volume=Traded Value then (This may store in one variable)
B=Volume may store in seperate varable.
Finally, ATP= (A)Total Taded Value(Turnover)/(B)No of Traded Shares I request o please modify the formula and oblige.
Thanking you with Kind Regards,
Haresh Patel |