PureBytes Links
Trading Reference Links
|
Hello TJ,
ad 1./ great sigh >GG< that I donīt have to
fumble around with the script part
ad 2./ this sped up the whole thing and improved
the swing drawing like "hell". THAAANKS!
ad 3./ I use a black background. Your suggestion
turned the bar color to white but I still donīt get the red (down) bars and
green (up) bars anymore though having that checked in preferences. Am I still
missing something?
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Tomasz Janeczko
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, February 18, 2003 8:58
PM
Subject: Re: [amibroker] Re: Canīt detect
proper cum values - attn. Tomasz
Markus,
1. Yes. No need to modify JScript part
2. Add SetBarsRequired( 200, 200 ) at the very top of the
formula. This should resolve the problem.
3. It depends on your colors set
in prefs. If you use bright background use
Graph1Color = colorBlack; (at the end of the formula), if you use
dark background use:
Graph1Color = colorWhite;
Updated formula follows.
/* SWING CHART
*/<FONT face="Courier New"
color=#0000ff size=2>
SetBarsRequired( <FONT
face="Courier New" color=#ff00ff size=2>200<FONT face="Courier New"
size=2>, 200<FONT
face="Courier New" size=2> ); <FONT face="Courier New" color=#008000
size=2>// needed for script
swingsize = <FONT face="Courier New" color=#ff00ff
size=2>10;
HP = <FONT face="Courier New" color=#0000ff
size=2>HHVBars( High, swingsize
) == 0<FONT
face="Courier New" size=2>;
LP = <FONT face="Courier New" color=#0000ff
size=2>LLVBars( Low, swingsize )
== 0<FONT
face="Courier New" size=2>;<FONT face="Courier New" color=#0000ff
size=2>
EnableScript(<FONT
face="Courier New" color=#ff00ff size=2>"jscript"<FONT
face="Courier New" size=2>);
<%
result = VBArray(AFL(<FONT face="Courier New" color=#ff00ff
size=2>"High")).toArray();
function TrendLine( starti, startv, endi, endv )
{
for( j = starti; j <= endi; j++ )
{
result[ j ] = startv + ( j - starti )*(endv-startv)/(endi-starti);
}
}
High = VBArray(AFL(<FONT face="Courier New" color=#ff00ff
size=2>"High")).toArray();
Low = VBArray(AFL(<FONT face="Courier New" color=#ff00ff
size=2>"Low")).toArray();
HP = VBArray(AFL(<FONT face="Courier New" color=#ff00ff
size=2>"HP")).toArray();
LP = VBArray(AFL(<FONT face="Courier New" color=#ff00ff
size=2>"LP")).toArray();
endi = -1<FONT
face="Courier New" size=2>;
starti = -<FONT face="Courier New" color=#ff00ff
size=2>1;
dir = 0<FONT
face="Courier New" size=2>;
for( i = High.length - <FONT face="Courier New" color=#ff00ff
size=2>0; i >= <FONT
face="Courier New" color=#ff00ff size=2>0<FONT face="Courier New"
size=2>; i-- )
{
if( dir == <FONT face="Courier New" color=#ff00ff
size=2>1 && LP[ i ] )
{
TrendLine( i, Low[ i ], endi, endv );
endi = i;
endv = Low[ i ];
dir = -1<FONT
face="Courier New" size=2>;
}
else
if( dir == -<FONT face="Courier New" color=#ff00ff
size=2>1 && HP[ i ] )
{
TrendLine( i, High[ i ], endi, endv );
endi = i;
endv = High[ i ];
dir = 1<FONT
face="Courier New" size=2>;
}
else
if( dir == <FONT face="Courier New" color=#ff00ff
size=2>0 && endi ==
-1<FONT
face="Courier New" size=2> && LP[ i ] )
{
endi = i;
endv = Low[ i ];
dir = -1<FONT
face="Courier New" size=2>;
}
else
if( dir == <FONT face="Courier New" color=#ff00ff
size=2>0 && endi ==
-1<FONT
face="Courier New" size=2> && HP[ i ] )
{
endi = i;
endv = High[ i ];
dir = 1<FONT
face="Courier New" size=2>;
}
}
AFL(<FONT face="Courier New" color=#ff00ff
size=2>"Graph0")=result;
%>
Graph0Color=colorRed;
Graph1=Close;
Graph1Color = colorBlack;
Graph1Style=styleCandle;
Best regards,Tomasz
Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
IVA GmbH
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, February 18, 2003 8:09
PM
Subject: [amibroker] Re: Canīt detect
proper cum values - attn. Tomasz
TJ,
the swing code works JUST FINE!!! Many, many
thanks!!!!
It still needs a few modifications on my part
but merely on how the swing conditions for HP and LP are
calculated.
Thus:
1./ Can I simply change the swing condition by
changing the condition for "HP" and "LP"? Or do I have to modify the jscript
part as well (unfortunately, have no expertise in this)?
2./ The swing lines seem to be calculated
"real-time" as one moves thru the chart. The last swing seems to be
imprecise plus "moves" up or down as I scroll forward. Is this
intended? Is there a
way to get rid of this (if desired) without the need for extensive
programming? If not, no major problem. This would slow down program speed,
right...?
3./ I have the "up and down bars" feature
activated in the preference settings. This seems to be disabled. How can I
turn this back on, please?
Great job this code!!!!!!
MarkusPost
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
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
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|