- Code: Select all
function Init()
...
indicator:requiredSource(core.Tick);
...
end
local first;
function Prepare()
...
first = instance.source:first() + 7;
...
end
function Update(period, mode)
...
if period >= first then
avg = mathex.avg(instance.source, period - 7 + 1, period);
end
...
end
Have a doubt at "first = instance.source:first() + 7;" what's +7 use for? can It use to control latest of stream of source?
and last question if i want to use previous price stream e.g. I want to use MVA at 20 previous step(not period) to calculate or implement new equation, How can i do that?
sorry my poor language is not native in english. Thank you.