PureBytes Links
Trading Reference Links
|
Hello,
I don't know what you use for your variables: DnPenSum and DnPenCount,
therefore i wrote the code below with dummy values.
Probably it does what you are trying to do. It searches at every bar
for DnPenSum[j] / DnPenCount[j] > 0 and checks all the previous bars
until it finds one or the first bar is reached. Thereafter it starts
with the next bar.
DnPenSum = C;
DnPenCount = L;
result = Null;
for (i = 0; i < BarCount - 1; i++)
{
for (j = i; j > 0; j--)
{
if (DnPenSum[j] / DnPenCount[j] > 0)
{
result[i] = DnPenSum[j] / DnPenCount[j];
break;
}
}
}
// Plot(C, "C", colorGreen, 128);
Plot(result, "Result", colorRed, 1);
Am 06.02.2010 16:47, schrieb cawalton111:
Hi all,
I have the following nested IIF statement but I suspect it is a clumsy beginners effort and would like to know if this can be parred down and perhaps extended beyond the 11 periods it covers, Thanks, Cliff
AvgDnPen=IIf((DnPenSum/DnPenCount > 0),DnPenSum/DnPenCount,
IIf(Ref(DnPenSum/DnPenCount,-1)> 0,Ref(DnPenSum/DnPenCount,-1),
IIf(Ref(DnPenSum/DnPenCount,-2)> 0,Ref(DnPenSum/DnPenCount,-2),
IIf(Ref(DnPenSum/DnPenCount,-3)> 0,Ref(DnPenSum/DnPenCount,-3),
IIf(Ref(DnPenSum/DnPenCount,-4)> 0,Ref(DnPenSum/DnPenCount,-4),
IIf(Ref(DnPenSum/DnPenCount,-5)> 0,Ref(DnPenSum/DnPenCount,-5),
IIf(Ref(DnPenSum/DnPenCount,-6)> 0,Ref(DnPenSum/DnPenCount,-6),
IIf(Ref(DnPenSum/DnPenCount,-7)> 0,Ref(DnPenSum/DnPenCount,-7),
IIf(Ref(DnPenSum/DnPenCount,-8)> 0,Ref(DnPenSum/DnPenCount,-8),
IIf(Ref(DnPenSum/DnPenCount,-9)> 0,Ref(DnPenSum/DnPenCount,-9),
IIf(Ref(DnPenSum/DnPenCount,-10)> 0,Ref(DnPenSum/DnPenCount,-10),
Ref(DnPenSum/DnPenCount,-11))))))))))));
PS its related to the Elder SafeZone stop calc's.
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@xxxxxxxxxxxxxxx
amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|
|