PureBytes Links
Trading Reference Links
|
--- doedau <don.edwards@xxxxxxxxxxxxxx> wrote:
> I thought this would carry updated 'value' forward
> but as usual I was
> wrong!
Hi Don,
Unfortunately, the only way to tackle this baby is to
use looping (gulp!!).
As many folks smarter than I have posted before, you
want to avoid looping unless absolutely necessary as
it is slower than linear (e.g. 0 * 1 = 0) or vector
math (e.g. iif(A, B, C) ).
So, when do you have to loop? In instances like this
where today's result is dependent on a previous value
of the result. Take a look at the Parabolic stop
example that Tomasz has provided for a better
explaination.
Anyway, here's the looping code with an exploration to
test the values.
Kind Regards,
Gary
StopLevel[0] = 1.1 * C[0];
for(i = 1; i < BarCount; i++)
{
if(C[ i ] > StopLevel[ i - 1 ])
{
StopLevel[ i ] = C[ i ] * 1.1;
}
else
{
StopLevel[ i ] = StopLevel[ i -1 ];
}
}
Filter = 1;
AddColumn(C, "Close", 5.2,colorDefault, IIf(C >
Ref(StopLevel, -1), colorRed, colorDefault));
AddColumn(C * 1.1, "New Stop Level if Prev Day Stop
Level Penetrated", 5.2);
AddColumn(StopLevel, "Stop Level", 5.2, colorDefault,
IIf(StopLevel != Ref(StopLevel, -1), colorRed, colorDefault));
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
---------------------------------------------------------------------~->
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/
|