Hello,
I have modified the CustomStoch.efs study to calculate the Stochastic for 4 time frames.
Below is a snippet of code in which the problem seems to occur.
For some reason, the Stochastics for interval 1 and 2 do not calculate.
I have confirmed that all variables are defined correctly.
As all four Stochastics are calculated in a similar manner, I have no idea what the cause is.
Output from the above code is
Thank you
Mark
I have modified the CustomStoch.efs study to calculate the Stochastic for 4 time frames.
Below is a snippet of code in which the problem seems to occur.
For some reason, the Stochastics for interval 1 and 2 do not calculate.
I have confirmed that all variables are defined correctly.
As all four Stochastics are calculated in a similar manner, I have no idea what the cause is.
PHP Code:
function main(KLength,KSmoothing,DLength,Symbol,Interval,Upper,Lower,Params)
{
chartInt = getInterval()
if (debugLevel > 0) debugPrintln("CustStoch: AFTER: getInterval() = " + chartInt + "\tInterval = " + Interval)
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = chartInt;
Interval_2 = Interval * 2;
Interval_3 = Interval * 3;
Interval_4 = Interval * 4;
var vSymbol_1 = Symbol+","+Interval;
var vSymbol_2 = Symbol+","+Interval_2;
var vSymbol_3 = Symbol+","+Interval_3;
var vSymbol_4 = Symbol+","+Interval_4;
if (debugLevel > 0) debugPrintln("Interval: " + Interval + "\tInterval_2: " + Interval_2 + "\tInterval_3: " + Interval_3 + "\tInterval_4: " + Interval_4);
if (debugLevel > 0) debugPrintln("vSymbol_1: " + vSymbol_1 + "\tvSymbol_2: " + vSymbol_2 + "\tvSymbol_3: " + vSymbol_3 + "\tvSymbol_4: " + vSymbol_4);
xStochK_1 = stochK(KLength,KSmoothing,DLength,sym(vSymbol_1)); xStochD_1 = stochD(KLength,KSmoothing,DLength,sym(vSymbol_1));
if (debugLevel > 0) debugPrintln("xStochK_1: " + xStochK_1 + "\txStochD_1: " + xStochD_1);
xStochK_2 = stochK(KLength,KSmoothing,DLength,sym(vSymbol_2)); xStochD_2 = stochD(KLength,KSmoothing,DLength,sym(vSymbol_2));
if (debugLevel > 0) debugPrintln("xStochK_2: " + xStochK_2 + "\txStochD_2: " + xStochD_2);
xStochK_3 = stochK(KLength,KSmoothing,DLength,sym(vSymbol_3)); xStochD_3 = stochD(KLength,KSmoothing,DLength,sym(vSymbol_3));
if (debugLevel > 0) debugPrintln("xStochK_3: " + xStochK_3 + "\txStochD_3: " + xStochD_3);
xStochK_4 = stochK(KLength,KSmoothing,DLength,sym(vSymbol_4)); xStochD_4 = stochD(KLength,KSmoothing,DLength,sym(vSymbol_4));
if (debugLevel > 0) debugPrintln("xStochK_4: " + xStochK_4 + "\txStochD_4: " + xStochD_4);
addBand( Upper, PS_SOLID, 1, Color.black,"Upper");
addBand( Lower, PS_SOLID, 1, Color.black,"Lower");
setShowTitleParameters(eval(Params));
bInit = true;
}
}
PHP Code:
CustStoch: AFTER: getInterval() = 10 Interval = null
Interval: 10 Interval_2: 20 Interval_3: 30 Interval_4: 40
vSymbol_1: ES #F,10 vSymbol_2: ES #F,20 vSymbol_3: ES #F,30 vSymbol_4: ES #F,40
xStochK_1: null xStochD_1: null
xStochK_2: null xStochD_2: null
xStochK_3: 44.26229508196721 xStochD_3: 36.458169088334586
xStochK_4: 25.471698113207548 xStochD_4: 23.642081189251016
Mark
Comment