Merging indicators intro strategy
Posted: Sun May 05, 2019 5:59 pm
Hello FXCM community,
I am trying to merge two indicators into a strategy to automatically place orders.
One of my indicator is using an internal stream, and I cannot find a way to get the same result on a custom strategy.
- INDICATOR
I need my rawstoch internal stream to update my ma indicator.
Any help ?
Thanks for your precious help
I am trying to merge two indicators into a strategy to automatically place orders.
One of my indicator is using an internal stream, and I cannot find a way to get the same result on a custom strategy.
- INDICATOR
- Code: Select all
local CCIPeriod = 10
local StochSmooth = 1
local StochPeriod = 10
function Prepare()
cci = core.indicators:create("CCI", source, CCIPeriod);
rawstoch = instance:addInternalStream(0, 0);
ma = core.indicators:create("MVA", rawstoch, StochSmooth);
end
function Update(period, mode)
local TodayCCI = cci.DATA[period];
local TodayLowCCI = mathex.min(cci.DATA, period - StochPeriod + 1, period);
local TodayHighCCI = mathex.max(cci.DATA, period - StochPeriod + 1, period);
rawstoch[period] = 100 * (TodayCCI - TodayLowCCI) / (TodayHighCCI - TodayLowCCI);
ma:update(mode);
end
I need my rawstoch internal stream to update my ma indicator.
Any help ?
Thanks for your precious help