arunaa wrote:Hi Tony,
That MACD works amazing..CAn you code a crossover similar to that but works like this..
1)the short moving average which gives the (highest high+lowest low)/2 for the past 9 periods
2)the longer moving average which gives the (highest high+lowest low)/2 for the past 26 periods
The crossover of the two line is very powerful..i tried coding it but it did not work..it uses the formulas of the tenkan-sen and kijun-sen of the ichimoku indicator..
highest high is the topmost part of any candle..
lowest low is the lowest part of the candle..
Arun
I'm not sure if i understand correctly, but from what you wrote i think you want regular moving average lines? One line is short for 9 periods and another one is long for 26 periods?
I've recoded current one to use simple moving average (MVA or SMA as some call it) instead of exponential moving average, i tested it and it seems to work.
- MACD2 with SMA-MVA.lua
- MACD that uses simple moving average instead of exponential moving average. Download in .LUA.
- (5.18 KiB) Downloaded 1581 times
If i misunderstood let me know.
EDIT: By the way, i might as well explain what i did so you can have little more control with your LUA indicators in future. FROM> indicator:name("MACD1");
TO>indicator:name("MACD with MVA instead of EMA");
(This is just a display name of the indicator)
FROM> indicator.parameters:addInteger("SN", "Short EMA", "(SN)No Description",
12, 2, 1000);
FROM> indicator.parameters:addInteger("LN", "Long EMA", "(LN)No Description",
26, 2, 1000);
TO> indicator.parameters:addInteger("SN", "Short MVA", "(SN)No Description",
12, 2, 1000);
TO> indicator.parameters:addInteger("LN", "Long MVA", "(LN)No Description",
26, 2, 1000);
(Here i changed parameter names,
RED: Those are parameters for actual periods, you can change them here or inside of MarketScope. Right click indicator line when you see it selected go to "Change Indicator", OR you can do this at creation time.)
FROM> EMAS = core.indicators:create(
"EMA", source, SN);
FROM> EMAL = core.indicators:create(
"EMA", source, LN);
TO> EMAS = core.indicators:create(
"MVA", source, SN);
TO> EMAL = core.indicators:create(
"MVA", source, LN);
(This is the actual place where you tell Indicore to create MVA indicators lines instead of EMA, you can specify here any indicators that are available in your installation, you specify them by their name.)
Hope it helps some. If not, let me know i'll do my best to get your problem solved.