foutmelding in code - vesticode

Vragen en suggesties over Vesticode

Moderator: Perry

foutmelding in code - vesticode

Berichtdoor Jo » vr 07 mei 2004, 18:59

Hoi,

Waarom gaat het hier fout bij invoegen van de indicator,
foutmelding:
function RSIadaptive, fout in regel 16, pos96, fout111 , .... , formula excteeted loop count.

Op te lossen door in de indicator deze formule aan te passen : xSeries te vervangen door de Close:
? ? ? ? ?RSI-adap =RSIadaptive ( xRSI, Length ) ;
door ? RSI-adap =RSIadaptive ( Close , Length ) ;

Waarom kan ik de bestaande xRSI niet nemen . Ik zou graag de gesmooth RSI reeks gebruiken.

Wie kan helpen ????


{---Functie RSI-adaptive---}

Inputs : xPrice(NumericSeries),Length(NumericSimple);
Vars ? : Counter(0),DownAmt(0),UpAmt(0),UpSum(0), DownSum(0),MyRange(0), temp(0);
Arrays: UpAvg[1](0), DnAvg[1](0);

if CurrentBar = 1 Then Begin
?UpSum = 0;
DownSum = 0; ?
?For Counter = 0 to Length-1 Begin
? ?UpAmt = xPrice[Counter] - xPrice[Counter+1];
? ?if (UpAmt >= 0) Then DownAmt = 0
? ?Else Begin
? ? ?DownAmt = -UpAmt;
? ? ?UpAmt = 0;
? ?End;
? ?UpSum = UpSum + UpAmt;
? ?DownSum = DownSum + DownAmt;
?End;
?UpAvg[1] = UpSum / Length;
?DnAvg[1] = DownSum / Length;
End

Else if CurrentBar > 1 then Begin ? ?

?UpAmt = xPrice[0] - xPrice[1];
?if UpAmt >= 0 Then Begin
? DownAmt = 0;
?End
?Else Begin
? DownAmt = -UpAmt;
? UpAmt = 0;
?End;
?UpAvg[1] = (UpAvg[1] * (Length - 1) + UpAmt) / Length;
?DnAvg[1] = (DnAvg[1] * (Length - 1) + DownAmt) / Length;
End;

temp = ?UpAvg[1]+DnAvg[1] ;
RSIadaptive = iff ( temp = 0 , 0 , ?100 * UpAvg[1] / temp) ;


{---indicator RSI-adaptive---}

value function RSI-Adaptive (value xSeries []= (H+l)/2
,value xNumberOfBars=14,value Length=5
,value xOverSold=30,value xOverBought=70) begin

?value xRSI[], RSI-adap[];

?xRSI := RSI(xSeries,xNumberOfbars);
?RSI-adap =RSIadaptive ( xRSI , Length) ;

?Plot1(xRSI,'RSI'+NumToStr(xNumberOfBars));
?Plot2(xOverSold);
?Plot3(xOverBought);
?Plot4(RSI-adap,'RSI-adaptice'+NumToStr(xNumberOfBars));
end;







Dank


(Edited by Jo at 11:09 am op 8,mei 2004)
Jo
 
Berichten: 44
Geregistreerd op: wo 07 jan 2004, 14:00

Keer terug naar Vesticode

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 4 gasten

cron