PureBytes Links
Trading Reference Links
|
Hi all
For up trending stoks, I want to find the shortest Simple moving
average period values that do not cross the price within any 52 bar
period for a portfolio of securities. Obviously different stocks
will have different period values at any given point in time and
also they will very with time within a stock.
I started coding the following. But it seems the variables that we
can use in a For loop can only be used for Array element and not
the way general computer languages like Pascal work.
I wold appreciate if someone can help me to get this code to work -
it appears that the j variable cannot be used to increment the
moving av period !!
Thanks in advance
//==================================================
// this checks whether the price is above its moving av 52 bars ago
and if so checks whether the close crossed mov av during the last 52
bars for a range of moving av periods and return the moing av period
value when it crosses
function WCBelowMALine(C)
{
result = 0;
for (j=52; j<3; j--)
{
result = IIf(Ref(C,-52) < Ref(MA(C,j),-52), -1,IIf(Hold(Cross(MA
(C,J),C),52),j+1 ,9));
}
return result;
}
//==================================================
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.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/
|