PureBytes Links
Trading Reference Links
|
<SPAN
class=515415713-27012004>I moved your title statement because you were using
"Setpoint" and "ScanPeriod" before you had defned them which you can't
do.
<SPAN
class=515415713-27012004>
<SPAN
class=515415713-27012004>The reason the exit from the while was not working is
that the variable N is a "Scalar" - just a plain old number and when you try to
assign the result of the IIF it is trying to put an array of numbers into that
scalar - that's the error message you were getting. Last Value will take
the number in the last element of the array and put it into N which solves
the problem.
<SPAN
class=515415713-27012004>
<SPAN
class=515415713-27012004>Now, having said all of that I don't know if the
results are what you intended BUT the escape from the While DOES
WORK.
<SPAN
class=515415713-27012004>
<SPAN
class=515415713-27012004>d
<SPAN
class=515415713-27012004>
<SPAN
class=515415713-27012004>-----------------------------------8<---------------------------------------------------------------------
<FONT face=Arial color=#0000ff
size=2>
/*Buy / Sell
Indicator based on a % Inrease / Decrease*/
GraphXSpace=
1000;Setpoint = 8;Color = IIf(C
>=Ref(C,-1),colorGreen,colorRed);YLevel = 50;ScanPeriod =
40;
Title = " " +
Name() + " - " + EncodeColor(colorRed) +Setpoint + "%" + EncodeColor(colorGreen)
+ " Buy " + EncodeColor(colorBlack) + " / " + EncodeColor(colorRed) + "
Sell - " + ScanPeriod + " Period Scan ";
N =
1;
while(N <=
ScanPeriod) { Change = ((C - LLV(C,N)) / C) *
100; Buy = Cross(Change,Setpoint);
Change = ((C - HHV(C,N)) / HHV(C,N)) * 100; Sell =
Cross(-Setpoint,Change);
N = lastvalue(IIf(Buy OR Sell, ScanPeriod + 1, N + 1));
Graph1 = YLevel;
PlotShapes(shapeSmallCircle,Color,0,YLevel, Offset = 0);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,YLevel-1);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,YLevel+1);}
<FONT face=Arial color=#0000ff
size=2>
From: Ron Krebs [mailto:rkrebs@xxxxxxxxxxxxx]
Sent: Tuesday, January 27, 2004 12:19 AMTo:
amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re: Breaking out of a
loop...
Sorry... Forgot to include the following code in the last
reply.Ron/*Buy / Sell Indicator based on a % Inrease /
Decrease*/Title = " " + Name() + " - " + EncodeColor(colorRed) +Setpoint
+ "%" + EncodeColor(colorGreen) + " Buy " + EncodeColor(colorBlack)
+ " / " + EncodeColor(colorRed) + " Sell - " + ScanPeriod + "
Period Scan "; GraphXSpace= 1000;Setpoint = 8;Color = IIf(C
>=Ref(C,-1),colorGreen,colorRed);YLevel = 50;ScanPeriod =
40;N = 1;while(N <= ScanPeriod) {Change = ((C - LLV(C,N)) /
C) * 100;Buy = Cross(Change,Setpoint);Change = ((C - HHV(C,N)) /
HHV(C,N)) * 100;Sell = Cross(-Setpoint,Change);N = IIf(Buy OR Sell,
ScanPeriod + 1, N + 1);Graph1 =
YLevel;PlotShapes(shapeSmallCircle,Color,0,YLevel, Offset =
0);PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,YLevel-1);PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,YLevel+1);}
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 the Yahoo! Terms of Service.
|