When I plot below 4 EMAs (10, 30, 60, Daily) on a 30min chart. The 20period 10min EMA is distorted. Would someone pls advise why?
var EMA_Interval_1 = 10;
var EMA_Interval_2 = 30;
var EMA_Interval_3 = 60;
var EMA_Interval_4 = "D";
var nMALength = 20;
function preMain()
{
setPriceStudy(true);
setCursorLabelName("daily EMA",0);
setDefaultBarThickness(4,0);
setDefaultBarFgColor(Color.blue,0);
setCursorLabelName("60m EMA",1);
setDefaultBarThickness(4,1);
setDefaultBarFgColor(Color.purple,1);
setCursorLabelName("30m EMA",2);
setDefaultBarThickness(4,2);
setDefaultBarFgColor(Color.cyan,2);
setCursorLabelName("10min EMA",3);
setDefaultBarThickness(4,3);
setDefaultBarFgColor(Color.yellow,3);
}
function main()
{
vEMA1 = ema(nMALength, inv(EMA_Interval_1));
vEMA2 = ema(nMALength, inv(EMA_Interval_2));
vEMA3 = ema(nMALength, inv(EMA_Interval_3));
vEMA4 = ema(nMALength, inv(EMA_Interval_4));
return new Array (vEMA4, vEMA3, vEMA2, vEMA1);
}
var EMA_Interval_1 = 10;
var EMA_Interval_2 = 30;
var EMA_Interval_3 = 60;
var EMA_Interval_4 = "D";
var nMALength = 20;
function preMain()
{
setPriceStudy(true);
setCursorLabelName("daily EMA",0);
setDefaultBarThickness(4,0);
setDefaultBarFgColor(Color.blue,0);
setCursorLabelName("60m EMA",1);
setDefaultBarThickness(4,1);
setDefaultBarFgColor(Color.purple,1);
setCursorLabelName("30m EMA",2);
setDefaultBarThickness(4,2);
setDefaultBarFgColor(Color.cyan,2);
setCursorLabelName("10min EMA",3);
setDefaultBarThickness(4,3);
setDefaultBarFgColor(Color.yellow,3);
}
function main()
{
vEMA1 = ema(nMALength, inv(EMA_Interval_1));
vEMA2 = ema(nMALength, inv(EMA_Interval_2));
vEMA3 = ema(nMALength, inv(EMA_Interval_3));
vEMA4 = ema(nMALength, inv(EMA_Interval_4));
return new Array (vEMA4, vEMA3, vEMA2, vEMA1);
}
Comment