PureBytes Links
Trading Reference Links
|
hello,
can someone help me with this code? I am attempting to spot bullish
divergences between price and stochs. the code successfully collects all the
price lows and the corresponding stochs values, but fails when I try to
compare the current prices and stoch values with the previous ones. I keep
getting a message saying "ther analysis technique is trying to reference
data past the bounds of the array". any idea on how to fix this?
thanks in advance
FR
if date = xxxxxxx {date with bullish divergences} then begin
Inputs: HighValue(High), LowValue(Low), CloseValue(Close), Length(14);
vars: StartofDay(false),LowestLowSoFarr(0),LowestStoch(0),Kline(0),Dline(0),
currentlow(0),previouslow(0),currentstoch(0),previousstoch(0),counterbis(fal
se),
PriceCounter(0),StochCounter(0);
array: lows[20](0);
array: stoch[20](0);
Kline = SlowKCustom(HighValue, LowValue, CloseValue, Length);
Dline = SlowDCustom(HighValue, LowValue, CloseValue, Length);
StartofDay = date<>date[1];
currentlow = lows[pricecounter];
-------------------------------------------------------------------------
-------------------------------------
previouslow = lows[pricecounter - 1];
currentstoch = stoch[stochcounter];
THIS PART IS NOT WORKING
previousstoch = stoch[stochcounter - 1];
condition1 = currentlow < previouslow and currentstoch >
iousstoch; -------------------------------------------------------------
-------- }
if StartofDay then begin
lowestlowsofarr = low;
stoch[StochCounter] = Kline[1];
StochCounter = StochCounter + 1;
end;
if Low < lowestlowsofarr then begin
lowestlowsofarr = minlist(low, lowestlowsofarr);
counterbis = false;
end;
if low > low[1] and counterbis = false then begin
lows[PriceCounter] = lowestlowsofarr;
stoch[StochCounter] = Kline[1];
messagelog(lows[pricecounter],time,getsymbolname); {this is to check that
it collects all lows without any repetitions}
PriceCounter = PriceCounter + 1;
counterbis = true;
end;
if Condition1 then
{ ----------------------------------------------------
THIS IS NOT WORKING
exitshort at
------------------------------------------------------- }
end;
|