[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] How else can i do this---CategoryAddSymbol



PureBytes Links

Trading Reference Links

You don't really need any loop.
Since you ask TDROC1<=varOversoldSignal to be true [equal to 1] for 
ALL the last n=16 bars, the Sum will be equal to 16.

n=16;
varOversold =Sum(TDROC1<=varOversoldSignal,n)==n ;

Dimitris Tsokakis

--- In amibroker@xxxxxxxxxxxxxxx, "Brian" <brian@xxxx> wrote:
> I am trying to consolidate this code into an array or a "for" loop, 
> so that it does the same thing, but more efficiently... can't seem 
> to find a decent example of AFL syntax right now... thanks!
> 
> varDuration = 16 // I would like to use this one variable, instead 
> of using Ref(TDROC1,-16) and so on...
> 
> // Identify oversold conditions, marked with red arrow to denote 
> downtrend
> varOversold = IIf(Ref(TDROC1,-16)<=varOversoldSignal 
> AND Ref(TDROC1,-15)<=varOversoldSignal 
> AND Ref(TDROC1,-14)<=varOversoldSignal 
> AND Ref(TDROC1,-13)<=varOversoldSignal 
> AND Ref(TDROC1,-12)<=varOversoldSignal 
> AND Ref(TDROC1,-11)<=varOversoldSignal 
> AND Ref(TDROC1,-10)<=varOversoldSignal 
> AND Ref(TDROC1,-9)<=varOversoldSignal 
> AND Ref(TDROC1,-8)<=varOversoldSignal 
> AND Ref(TDROC1,-7)<=varOversoldSignal 
> AND Ref(TDROC1,-6)<=varOversoldSignal 
> AND Ref(TDROC1,-5)<=varOversoldSignal 
> AND Ref(TDROC1,-4)<=varOversoldSignal 
> AND Ref(TDROC1,-3)<=varOversoldSignal 
> AND Ref(TDROC1,-2)<=varOversoldSignal 
> AND Ref(TDROC1,-1)<=varOversoldSignal 
> AND TDROC1<=varOversoldSignal ,1,0);
> IIf(varOversold>0,PlotShapes
> (shapeHollowDownArrow*varOversold,colorRed),0);



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/