Thanks Ed,
I was working with Value When, but obviously not paying enough attention
to some details .. which caused a lot of problems ... and started
questioning myself
Finally got it working right ... needed a long break before started
seeing the details
Ara
On 08/15/2010 1:09 AM, Edward Pottasch wrote:
hi Ara,
you use valuewhen for that.
I adjusted some code I posted earlier as an example,
regards, Ed
// E.M.Pottasch 08/15/10
SetBarsRequired(sbrAll,sbrAll);
nbar = Param("nbar",10,2,50,1);
PLow = L < Ref(LLV(L,nbar),-1) AND Ref(LLV(L,nbar),nbar) > L;
PLowPrice = ValueWhen(PLow,L);
// bottoms
b1 = ValueWhen(PLow,PLowPrice,1); // most recent bottom
b2 = ValueWhen(PLow,PLowPrice,2); // bottom prior b1
// higher low OR lower low
higherLow = IIf(PLow AND b1 > b2,1,0);
lowerLow = IIf(PLow AND b1 < b2,1,0);
// chart
GraphXSpace = 5;
SetChartOptions(0, chartShowDates);
Plot(C,"\nLast",colorWhite,styleCandle);
Plot(b1,"b1",colorWhite,1);
Plot(b2,"b2",colorWhite,styleDashed);
// show higherLow using Green color, lowerLow with Red color
PlotShapes(shapeCircle*PLow,IIf(higherLow,colorBrightGreen,IIf(lowerLow,colorRed,colorLightGrey)),0,L,-10);
*From:* Ara Kaloustian <mailto:[email protected]>
*Sent:* Sunday, August 15, 2010 7:03 AM
*To:* AB-Main <mailto:[email protected]>
*Subject:* [amibroker] Array Processing
Having a lot of trouble with some array processing.
I want to compare the low points of a stochastic.
I define the reversal points as
Trough_Def = StocK > Ref(StocK,-1) AND Ref(StocK,-1) < Ref(StocK,-2);
shift the array by one bar
Stoc_Low = Ref(Trough_Def,1);
So far so good.
Now I want to know which low points are higher than prior low. This is
easy to do for the last two lows (or any two lows from the selected
bar), but I can't figure out how to create an array with that info for
the entire data set, so it can be used for backtesting.
Thanks in advance
Ara