Preferred Stochastic, with EasyLanguage/ Multicharts

Hello,
I'm testing the Multicharts platform, And trying to create the "Preffered Stochastic" of DiNapoli. I apply in the power language editor the code in the book:


PreferredSlowK (Function)

Inputs: SlowKLen(Numeric), FastKLen(Numeric);
PreferredSlowK = PreferredSlowK[1] + ((1/SlowKLen)*(FastK(FastKLen) -
PreferredSlowK[l]));

PreferredSlowD (Function)

Input: FastKLen(Numeric), SlowKLen(Numeric), SlowDLen(Numeric);
PreferredSlowD = PreferredSlowD[1] + ((1/SlowDLen)*(PreferredSlowK(SlowKLen,
FastKLen)-PreferredSlowD[1]));

StochasticPreferred (Indicator)

Input: FastKLen(8), SlowKLen(3), SlowDLen(3);
Plot1(PreferredSlowK(SlowKLen, FastKLen), "%K");
Plot2(PreferredSlowD(FastKLen, SlowKLen, SlowDLen), "%D");
If CheckAlert then
begin
If Plot1 crosses above Plot2 or
Plot1 crosses below Plot2 then
Alert = TRUE;
end;


I passed the "compile" button, and everything is ok, but when I tried to put in a chart, there is an error message that says:
"Message: Error in study "StochasticPreferred": Not enough series length. Bars reference value: 1370"

I don't know where is the problem. I would thanks if someone knows what could I do.
 
I think the "Not enough series length. Bars reference value:" error indicates that there is not enough data loaded in the chart. Try editing the symbol and increasing the number of bars back.
 
Quote from csancho:

Thank you gttrader.
I did it, and finally it draws an stochasticPreferred, but the draw is just a line.
It has to be an error in the language, but, where?

Increase the scale on the Stochastic Chart
 
Found the error, just a simple typo at the end of the PreferredSlowK there is an l in place of a 1. Should be like this.

PreferredSlowK (Function)

Inputs: SlowKLen(Numeric), FastKLen(Numeric);
PreferredSlowK = PreferredSlowK[1] + ((1/SlowKLen)*(FastK(FastKLen) -
PreferredSlowK[1]));
 

Attachments

Back
Top