PureBytes Links
Trading Reference Links
|
Hi
MSG,
<SPAN
class=457443721-02052004><FONT face=Arial color=#0000ff
size=2>
With
Quick AFL enabled, it dies as soon as I click on a bar or switch
tickers.
In
case you don't observe that, the error is
x1 =
SelectedBar; y1=C[SelectedBar];
<FONT face=Arial color=#0000ff
size=2>
^
<FONT face=Arial color=#0000ff
size=2> |
<FONT face=Arial color=#0000ff
size=2>------------------------------
error
7
<FONT face=Arial color=#0000ff
size=2>Subscript out of range
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Haven't seen any crashes with Quick AFL disabled, but know not what
to test.
[Like
Ken, I'm flying nearly blind.]
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Bob
<FONT face=Arial color=#0000ff
size=2>
-----Original
Message-----From: Michael.S.G.
[mailto:OzFalcon@xxxxxxxxxx]Sent: Saturday, May 01, 2004 8:07
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Test
Request
Hi Everyone,
I have
just completed "Manual Stop Entry" indicator which may be usefull for others.
(If even just to examine the code to see how it works).Also, I need
some people to just let me know if it works for them - Before I
post it to the AFL archive. Use the parameters dialog
(CTRL-R) to adjust settings.Code: (And Attached)<FONT
face="Courier New, Courier" color=#008000 size=2>// Manual Stop Entry
V1.00//
Created 1/5/04//
Author OzFalcon
(Michael.S.G.).//
Purpose Manualy
Enter & Track Trades.//
Type Indicator//
Notes Use
Parameters (CTRL-R) to Set & Save.//
Notes
(Buybar is set with Currently Selected Bar.)// Set Trade
EquityCash = <FONT
face="Courier New, Courier" color=#0000ff size=2>Param<FONT
face="Courier New, Courier" size=2>(<FONT face="Courier New, Courier"
color=#ff00ff size=2>"6.Cash"<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0,<FONT
face="Courier New, Courier" color=#ff00ff size=2>0<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>10000<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0.01);Comm =
<FONT face="Courier New, Courier" color=#0000ff
size=2>Param(<FONT
face="Courier New, Courier" color=#ff00ff size=2>"7.Comm"<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>0<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0,<FONT
face="Courier New, Courier" color=#ff00ff size=2>50<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>0.01<FONT face="Courier New, Courier"
size=2>);<FONT face="Courier New, Courier" color=#008000
size=2>// Plot Price & Turnover.<FONT
face="Courier New, Courier" size=2>Color = <FONT
face="Courier New, Courier" color=#0000ff size=2>IIf<FONT
face="Courier New, Courier" size=2>(O > C, colorBlack,
colorLightYellow);<FONT face="Courier New, Courier"
color=#0000ff size=2>Plot(
Close, <FONT face="Courier New, Courier" color=#ff00ff
size=2>"Price", color,
styleCandle );<FONT face="Courier New, Courier"
color=#0000ff size=2>PlotForeign<FONT face="Courier New, Courier"
size=2>( <FONT face="Courier New, Courier" color=#0000ff
size=2>GetBaseIndex(),
<FONT face="Courier New, Courier" color=#0000ff
size=2>GetBaseIndex(),
colorAqua, styleLine | styleThick |
styleOwnScale); Turnover = (V*C);BarColor =
<FONT face="Courier New, Courier" color=#0000ff
size=2>IIf( Turnover >
Ref<FONT
face="Courier New, Courier" size=2>(Turnover,-<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2>), colorRed , <FONT
face="Courier New, Courier" color=#008000 size=2>/* up volume */<FONT
face="Courier New, Courier" size=2> <FONT
face="Courier New, Courier" color=#0000ff size=2>IIf<FONT
face="Courier New, Courier" size=2>( Turnover < <FONT
face="Courier New, Courier" color=#0000ff size=2>Ref<FONT
face="Courier New, Courier" size=2>(Turnover,-<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2>), colorOrange, <FONT
face="Courier New, Courier" color=#008000 size=2>/* down volume
*/<FONT face="Courier New, Courier"
size=2>
colorGreen <FONT face="Courier New, Courier" color=#008000
size=2>/*otherwise*/
));<FONT face="Courier New, Courier" color=#0000ff
size=2>Plot( Turnover,
<FONT face="Courier New, Courier" color=#ff00ff
size=2>"Turnover", BarColor,
styleHistogram | styleThick |
styleOwnScale);<FONT face="Courier New, Courier"
color=#008000 size=2>// Set Global Variables.<FONT
face="Courier New, Courier" size=2>BC = BarCount-<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2>;BNUM = <FONT
face="Courier New, Courier" color=#0000ff size=2>BarIndex<FONT
face="Courier New, Courier" size=2>();<FONT
face="Courier New, Courier" color=#008000 size=2>// Set Default BuyBar &
BuyAt etc.SelectedBar =
<FONT face="Courier New, Courier" color=#0000ff
size=2>SelectedValue(BNUM);
BuyBar = SelectedBar;BuyAt = <FONT face="Courier New, Courier"
color=#0000ff size=2>Param<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"1.BuyAt",<FONT
face="Courier New, Courier" color=#ff00ff size=2>0<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>0<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>100,<FONT
face="Courier New, Courier" color=#ff00ff size=2>0.01<FONT
face="Courier New, Courier" size=2>);EvenStop = <FONT
face="Courier New, Courier" color=#0000ff size=2>Param<FONT
face="Courier New, Courier" size=2>(<FONT face="Courier New, Courier"
color=#ff00ff size=2>"2.EvenStop"<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>1,<FONT
face="Courier New, Courier" color=#ff00ff size=2>0<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>100<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0.01); <FONT
face="Courier New, Courier" color=#008000 size=2>//Percentage Of Buy
PriceProfitStop =
<FONT face="Courier New, Courier" color=#0000ff
size=2>Param(<FONT
face="Courier New, Courier" color=#ff00ff size=2>"3.ProfitStop"<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>2<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0,<FONT
face="Courier New, Courier" color=#ff00ff size=2>100<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>0.01);
//Percentage of
Buy Price.LossStop =
<FONT face="Courier New, Courier" color=#0000ff
size=2>Param(<FONT
face="Courier New, Courier" color=#ff00ff size=2>"4.LossStop"<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>2<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0,<FONT
face="Courier New, Courier" color=#ff00ff size=2>100<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>0.01);
//Percentage of
Buy Price.TrailStop =
<FONT face="Courier New, Courier" color=#0000ff
size=2>Param(<FONT
face="Courier New, Courier" color=#ff00ff size=2>"5.TrailStop"<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>2<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0,<FONT
face="Courier New, Courier" color=#ff00ff size=2>100<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>0.01);
//Percentage
from Highest High since BuyBar.// Overide Default BuyBar & BuyAt
if previously Set or Write setup.<FONT face="Courier New, Courier"
size=2>LockSet = <FONT face="Courier New, Courier" color=#0000ff
size=2>Param(<FONT
face="Courier New, Courier" color=#ff00ff size=2>"Lock/Set"<FONT
face="Courier New, Courier"
size=2>,False,False,True,<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2>);TrailName = <FONT
face="Courier New, Courier" color=#ff00ff size=2>"Data/"<FONT
face="Courier New, Courier" size=2> + <FONT face="Courier New, Courier"
color=#0000ff size=2>Name<FONT face="Courier New, Courier"
size=2>()+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"~Stop.txt"<FONT face="Courier New, Courier"
size=2>;<FONT face="Courier New, Courier" color=#800000
size=2>if (LockSet ==
False) { fh
= <FONT face="Courier New, Courier" color=#0000ff
size=2>fopen( TrailName,
"r"<FONT
face="Courier New, Courier" size=2>);
<FONT
face="Courier New, Courier" color=#800000 size=2>if<FONT
face="Courier New, Courier" size=2>( fh )
{
BuyBar
= <FONT face="Courier New, Courier" color=#0000ff
size=2>StrToNum(<FONT
face="Courier New, Courier" color=#0000ff size=2>fgets<FONT
face="Courier New, Courier" size=2>( fh ));
BuyAt
= <FONT face="Courier New, Courier" color=#0000ff
size=2>StrToNum(<FONT
face="Courier New, Courier" color=#0000ff size=2>fgets<FONT
face="Courier New, Courier" size=2>( fh
)); EvenStop
= <FONT face="Courier New, Courier" color=#0000ff
size=2>StrToNum(<FONT
face="Courier New, Courier" color=#0000ff size=2>fgets<FONT
face="Courier New, Courier" size=2>( fh
)); ProfitStop
= <FONT face="Courier New, Courier" color=#0000ff
size=2>StrToNum(<FONT
face="Courier New, Courier" color=#0000ff size=2>fgets<FONT
face="Courier New, Courier" size=2>( fh
)); LossStop
= <FONT face="Courier New, Courier" color=#0000ff
size=2>StrToNum(<FONT
face="Courier New, Courier" color=#0000ff size=2>fgets<FONT
face="Courier New, Courier" size=2>( fh
)); TrailStop
= <FONT face="Courier New, Courier" color=#0000ff
size=2>StrToNum(<FONT
face="Courier New, Courier" color=#0000ff size=2>fgets<FONT
face="Courier New, Courier" size=2>( fh
)); Cash
= <FONT face="Courier New, Courier" color=#0000ff
size=2>StrToNum(<FONT
face="Courier New, Courier" color=#0000ff size=2>fgets<FONT
face="Courier New, Courier" size=2>( fh
)); Comm
= <FONT face="Courier New, Courier" color=#0000ff
size=2>StrToNum(<FONT
face="Courier New, Courier" color=#0000ff size=2>fgets<FONT
face="Courier New, Courier" size=2>( fh
)); <FONT
face="Courier New, Courier" color=#0000ff size=2>fclose<FONT
face="Courier New, Courier" size=2>( fh
); TitleS=<FONT
face="Courier New, Courier" color=#ff00ff size=2>"ReadFile"<FONT
face="Courier New, Courier" size=2>;
} <FONT
face="Courier New, Courier" color=#800000 size=2>else<FONT
face="Courier New, Courier" size=2>
{
<FONT
face="Courier New, Courier" color=#0000ff size=2>printf<FONT
face="Courier New, Courier" size=2>(<FONT face="Courier New, Courier"
color=#ff00ff size=2>"Trail Not Set\n"<FONT face="Courier New, Courier"
size=2>); BuyBar=BC; BuyAt=C[BuyBar]; TitleS=<FONT
face="Courier New, Courier" color=#ff00ff size=2>"NoFile"<FONT
face="Courier New, Courier"
size=2>; } } <FONT
face="Courier New, Courier" color=#800000 size=2>else<FONT
face="Courier New, Courier"
size=2> { BuyBar
= <FONT face="Courier New, Courier" color=#0000ff
size=2>IIf ((BuyBar ==
0<FONT
face="Courier New, Courier"
size=2>),BC,BuyBar); BuyAt
= <FONT face="Courier New, Courier" color=#0000ff
size=2>IIf ((BuyAt ==
0<FONT
face="Courier New, Courier"
size=2>),C[BuyBar],BuyAt); TitleS
= <FONT face="Courier New, Courier" color=#ff00ff
size=2>"SaveFile"<FONT face="Courier New, Courier"
size=2>; fh
= <FONT face="Courier New, Courier" color=#0000ff
size=2>fopen( TrailName,
"w"<FONT
face="Courier New, Courier" size=2>);
<FONT
face="Courier New, Courier" color=#800000 size=2>if<FONT
face="Courier New, Courier" size=2>( fh )
{
<FONT
face="Courier New, Courier" color=#0000ff size=2>fputs<FONT
face="Courier New, Courier" size=2>( <FONT face="Courier New, Courier"
color=#0000ff size=2>StrFormat<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%.00f\n",BuyBar), fh
);
<FONT
face="Courier New, Courier" color=#0000ff size=2>fputs<FONT
face="Courier New, Courier" size=2>( <FONT face="Courier New, Courier"
color=#0000ff size=2>StrFormat<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%.02f\n",BuyAt ), fh
); <FONT
face="Courier New, Courier" color=#0000ff size=2>fputs<FONT
face="Courier New, Courier" size=2>( <FONT face="Courier New, Courier"
color=#0000ff size=2>StrFormat<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%.02f\n",EvenStop ),
fh );
<FONT
face="Courier New, Courier" color=#0000ff size=2>fputs<FONT
face="Courier New, Courier" size=2>( <FONT face="Courier New, Courier"
color=#0000ff size=2>StrFormat<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%.02f\n",ProfitStop ),
fh );
<FONT
face="Courier New, Courier" color=#0000ff size=2>fputs<FONT
face="Courier New, Courier" size=2>( <FONT face="Courier New, Courier"
color=#0000ff size=2>StrFormat<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%.02f\n",LossStop ),
fh );
<FONT
face="Courier New, Courier" color=#0000ff size=2>fputs<FONT
face="Courier New, Courier" size=2>( <FONT face="Courier New, Courier"
color=#0000ff size=2>StrFormat<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%.02f\n",TrailStop ),
fh );
<FONT
face="Courier New, Courier" color=#0000ff size=2>fputs<FONT
face="Courier New, Courier" size=2>( <FONT face="Courier New, Courier"
color=#0000ff size=2>StrFormat<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%.02f\n",Cash ), fh
);
<FONT
face="Courier New, Courier" color=#0000ff size=2>fputs<FONT
face="Courier New, Courier" size=2>( <FONT face="Courier New, Courier"
color=#0000ff size=2>StrFormat<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%.02f\n",Comm ), fh
);
<FONT
face="Courier New, Courier" color=#0000ff size=2>fclose<FONT
face="Courier New, Courier" size=2>( fh );
} }<FONT
face="Courier New, Courier" color=#008000 size=2>// Plot Vertical &
Horizontal Buy Bar/Price. (Blue/Yellow)<FONT
face="Courier New, Courier" size=2>VLine = <FONT
face="Courier New, Courier" color=#0000ff size=2>IIf<FONT
face="Courier New, Courier" size=2>(BuyBar==BNUM,<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>0<FONT face="Courier New, Courier"
size=2>); <FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2> (VLine ,<FONT
face="Courier New, Courier" color=#ff00ff size=2>"BuyBar"<FONT
face="Courier New, Courier" size=2>, colorBlue, styleHistogram |
styleOwnScale,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0,<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2>);x0 = Buybar-<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2> ; x1 = BuyBar+<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2> ;y0 = BuyAt; y1 = BuyAt;Hline =
<FONT face="Courier New, Courier" color=#0000ff
size=2>LineArray<FONT face="Courier New, Courier"
size=2>(x0,y0,x1,y1,<FONT face="Courier New, Courier" color=#ff00ff
size=2>3<FONT face="Courier New, Courier"
size=2>); <FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2>(HLine ,<FONT
face="Courier New, Courier" color=#ff00ff size=2>"BuyPrice"<FONT
face="Courier New, Courier"
size=2>,colorYellow,styleLine);<FONT
face="Courier New, Courier" color=#008000 size=2>// Plot Trade Trend (BuyBar
to Current Bar - Blue Dashed Line).<FONT
face="Courier New, Courier" size=2>x0 = Buybar ; x1 = BC ;y0 = BuyAt; y1 =
C[BC];Hline = <FONT face="Courier New, Courier"
color=#0000ff size=2>LineArray<FONT face="Courier New, Courier"
size=2>(x0,y0,x1,y1,<FONT face="Courier New, Courier" color=#ff00ff
size=2>1<FONT face="Courier New, Courier"
size=2>); <FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2>(HLine ,<FONT
face="Courier New, Courier" color=#ff00ff size=2>"TradeTrend"<FONT
face="Courier New, Courier"
size=2>,colorLightBlue,styleDots);<FONT
face="Courier New, Courier" color=#008000 size=2>// Plot Break Even Horizontal
(Green).x0 =
Buybar-<FONT face="Courier New, Courier" color=#ff00ff
size=2>1 ; x1 =
BuyBar+<FONT face="Courier New, Courier" color=#ff00ff
size=2>1 ;y0 =
BuyAt*(<FONT face="Courier New, Courier" color=#ff00ff
size=2>1<FONT face="Courier New, Courier"
size=2>+(EvenStop/<FONT face="Courier New, Courier" color=#ff00ff
size=2>100)) ;y1=y0;Hline
= <FONT face="Courier New, Courier" color=#0000ff
size=2>LineArray<FONT face="Courier New, Courier"
size=2>(x0,y0,x1,y1,<FONT face="Courier New, Courier" color=#ff00ff
size=2>1<FONT face="Courier New, Courier"
size=2>); <FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2>(HLine ,<FONT
face="Courier New, Courier" color=#ff00ff size=2>"EvenStop"<FONT
face="Courier New, Courier"
size=2>,colorGreen,styleLine);<FONT
face="Courier New, Courier" color=#008000 size=2>// Plot Profit Stop
Horizontal (Orange)x0 =
Buybar-<FONT face="Courier New, Courier" color=#ff00ff
size=2>1 ; x1 =
BuyBar+<FONT face="Courier New, Courier" color=#ff00ff
size=2>1 ;y0 =
BuyAt*(<FONT face="Courier New, Courier" color=#ff00ff
size=2>1<FONT face="Courier New, Courier"
size=2>+(ProfitStop/<FONT face="Courier New, Courier" color=#ff00ff
size=2>100)) ;y1=y0;Hline
= <FONT face="Courier New, Courier" color=#0000ff
size=2>LineArray<FONT face="Courier New, Courier"
size=2>(x0,y0,x1,y1,<FONT face="Courier New, Courier" color=#ff00ff
size=2>1<FONT face="Courier New, Courier"
size=2>); <FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2>(HLine ,<FONT
face="Courier New, Courier" color=#ff00ff size=2>"ProfitStop"<FONT
face="Courier New, Courier"
size=2>,colorOrange,styleLine);<FONT
face="Courier New, Courier" color=#008000 size=2>// Plot Loss Stop Horizontal
(Red).x0 =
Buybar-<FONT face="Courier New, Courier" color=#ff00ff
size=2>1 ; x1 =
BuyBar+<FONT face="Courier New, Courier" color=#ff00ff
size=2>1 ;y0 =
BuyAt*(<FONT face="Courier New, Courier" color=#ff00ff
size=2>1<FONT face="Courier New, Courier"
size=2>-(LossStop/<FONT face="Courier New, Courier" color=#ff00ff
size=2>100)) ;y1=y0;Hline
= <FONT face="Courier New, Courier" color=#0000ff
size=2>LineArray<FONT face="Courier New, Courier"
size=2>(x0,y0,x1,y1,<FONT face="Courier New, Courier" color=#ff00ff
size=2>1<FONT face="Courier New, Courier"
size=2>); <FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2>(HLine ,<FONT
face="Courier New, Courier" color=#ff00ff size=2>"LossStop"<FONT
face="Courier New, Courier"
size=2>,colorRed,styleLine);<FONT
face="Courier New, Courier" color=#008000 size=2>// Plot Trail Stop Trend
(Highest High to Current Bar - Orange Dashed Line).<FONT
face="Courier New, Courier" size=2>ThisIsBuyBar = (BNUM ==
BuyBar);TrailPeak = BC-(<FONT face="Courier New, Courier"
color=#0000ff size=2>LastValue<FONT face="Courier New, Courier"
size=2>(<FONT face="Courier New, Courier" color=#0000ff
size=2>HighestSinceBars<FONT face="Courier New, Courier"
size=2>(ThisIsBuyBar,High,<FONT face="Courier New, Courier"
color=#ff00ff size=2>1<FONT face="Courier New, Courier"
size=2>)));ThisIsTrailPeak = (BNUM == TrailPeak);PeakValue =
High[TrailPeak];x0 = TrailPeak; y0=PeakValue;x1 = SelectedBar;
y1=C[SelectedBar];Line = <FONT face="Courier New, Courier"
color=#0000ff size=2>LineArray<FONT face="Courier New, Courier"
size=2>(x0,y0,x1,y1,<FONT face="Courier New, Courier" color=#ff00ff
size=2>0);<FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2>(Line,<FONT
face="Courier New, Courier" color=#ff00ff size=2>"TrailStop"<FONT
face="Courier New, Courier"
size=2>,colorOrange,styleDots);TrailValue =
((y1/y0)-<FONT face="Courier New, Courier" color=#ff00ff
size=2>1)*<FONT
face="Courier New, Courier" color=#ff00ff size=2>100<FONT
face="Courier New, Courier" size=2>;<FONT
face="Courier New, Courier" color=#008000 size=2>// Calculate Holding
Stats.Avail =
Cash-Comm;Qty = <FONT face="Courier New, Courier" color=#0000ff
size=2>int<FONT face="Courier New, Courier"
size=2>((Avail/BuyAt));Remain = Avail-(Qty*BuyAt);Value =
((Close*Qty)-Comm)+Remain;Change = Value-Cash;Gain =
((Value/Avail)-<FONT face="Courier New, Courier" color=#ff00ff
size=2>1)*<FONT
face="Courier New, Courier" color=#ff00ff size=2>100<FONT
face="Courier New, Courier" size=2>;<FONT
face="Courier New, Courier" color=#008000 size=2>// Dynamic
Title<FONT face="Courier New, Courier" color=#0000ff
size=2>_N(Title =
<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\\c29"<FONT face="Courier New, Courier"
size=2>+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"Trail Stop "<FONT face="Courier New, Courier"
size=2>+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\\c32"+ <FONT
face="Courier New, Courier" color=#0000ff size=2>Date<FONT
face="Courier New, Courier" size=2>()+ <FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c29 Ticker:
\\c32"+<FONT
face="Courier New, Courier" color=#0000ff size=2>Name<FONT
face="Courier New, Courier" size=2>()+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c29 Index:
\\c24"+<FONT
face="Courier New, Courier" color=#0000ff size=2>GetBaseIndex<FONT
face="Courier New, Courier" size=2>()+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\n"<FONT
face="Courier New, Courier" size=2>+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c38 Open
\\c01"<FONT face="Courier New, Courier"
size=2>+O+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\\c38 Hi \\c01"<FONT face="Courier New, Courier"
size=2>+H+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\\c38 Low \\c01"<FONT face="Courier New, Courier"
size=2>+L+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\\c38 Close \\c01"<FONT face="Courier New, Courier"
size=2>+C+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\n"+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c38 TurnOver
\\c24"+<FONT
face="Courier New, Courier" color=#0000ff size=2>WriteVal<FONT
face="Courier New, Courier" size=2>(TurnOver,<FONT
face="Courier New, Courier" color=#ff00ff size=2>1<FONT
face="Courier New, Courier" size=2>)+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c29 SelectedBar:
\\c32"+
SelectedBar+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\n"+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c38 Cash
\\c01"+Cash+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c38 Comm
\\c01"+Comm+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c38 Qty \\c01"<FONT
face="Courier New, Courier" size=2>+Qty+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\n"<FONT
face="Courier New, Courier" size=2>+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c38 Vaule
\\c01$"+Value+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c38 Change
\\c01$"<FONT face="Courier New, Courier"
size=2>+Change+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\\c38 Gain \\c01"<FONT face="Courier New, Courier"
size=2>+Gain+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%"+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\n"<FONT
face="Courier New, Courier" size=2>+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\\c29 TrailPeekBar:
\\c01"<FONT face="Courier New, Courier"
size=2>+TrailPeak+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"\\c29 Trail \\c01"<FONT face="Courier New, Courier"
size=2>+TrailValue+<FONT face="Courier New, Courier" color=#ff00ff
size=2>"%"+<FONT
face="Courier New, Courier" color=#ff00ff size=2>"\n"<FONT
face="Courier New, Courier" size=2> + TitleS +<FONT
face="Courier New, Courier" color=#ff00ff size=2>""<FONT
face="Courier New, Courier" size=2>);<FONT
face="Courier New, Courier" color=#008000 size=2>//
End.Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend
SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------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
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 Sponsor
ADVERTISEMENT
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.
|