Hello to everybody,
I have created some function and I wanted to pass the created VWAP array to that function but nothing is happening, My code is not giving any error but nothing is plotting
this is my piece of code, Can anybody help me with this.
Bars_so_far_today = 1 + BarsSince( DateNum() != Ref(DateNum(), -1));
StartBar = ValueWhen(TimeNum() == 093000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) / TodayVolume,0);
//Plot (VWAP,"VWAP",colorOrange, styleThick);
function myEMA(array)
{
k=0.5;
result[0]=(1-k)*array[0];
for (i = 1; i < BarCount; i++)
{
result[0] = array[0];
result[i] = k* result[i - 1] + (1-k)*array[i];
}
return result;
}
a=myEMA(VWAP); //passing VWAP value to my function
Plot(a,"value",colorRed,styleLine);