I am attempting to make a script for 10 weeks moving average of friday close developed by Larry Williams. I made script based on NinjaTrader SMA Indicator, but it seems doesn't work.
Here is modified piece of code:
protected override void OnBarUpdate()
{
if (CurrentBar == 0 && Time[0].DayOfWeek == DayOfWeek.Friday)
Value.Set(Input[0]);
else
if (Time[0].DayOfWeek == DayOfWeek.Friday)
{
double last = Value[1] * Math.Min(CurrentBar, Period);
if (CurrentBar >= Period)
Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
else
Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
}
I want filter out only friday's Close for 10 weeks and plot solid line into chart.
Please, could you help me guys.
regards
sniper29a
Comment