For anybody interested, I have spent a little time with the AFL file
that I posted earlier today and I have tweaked this code to:
1.
Remove redundant signals from charts using Equity(1,0)
2.
Added tooltips function to read the price arrays easier on charts
3.
Added a buy/sell trigger ribbon
4.
Other minor tweaks
The code seems to demonstrate expected behavior i.e. buys and sells on
the correct bars and at the expected prices!
Cheers,
Gordon
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of
Gordon Sutherland
Sent: Saturday, 26 January 2008 10:14 a.m.
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Q regarding removing succeeding signals from
HighestSince or LowestSince
Hi Larry,
I believe iterating through the price array using loops is the best
solution. For those (like me) uncomfortable with looping there is some
code
that I believe will do what you want in the form of a custom function
posted
by Geoff Mulhall on 24th October 2004. I attach:
1. The dll file to be placed in your \AmiBroker\Plugins folder
2. The AFL file
3. Text readme file
4. Graphic illustration png file
I hope this helps with your Chandelier Exits.
Regards,
Gordon
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf
Of onelkm
Sent: Saturday, 26 January 2008 8:38 a.m.
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Q regarding removing succeeding signals from
HighestSince or LowestSince
I have struggled with the same issue.... can someone help - is there
a solution?
Larry
--- In amibroker@xxxxxxxxxxxxxxx, "janhausd"
<janhaus@xxx> wrote:
>
> Hi,
>
> I did some searching in the posts, and it looks like many people
have
> asked for methods to remove the extraneous signals from
HighestSince
> or LowestSince so that the function can return the very first
signal
> and not the ones which appear afterwards.
>
> I've tried copying the code from these two posts, using loops or
loops
> + global vars, or some combination of ExRem, or Flip or ExRemSpan
but
> I have not yet gotten it working:
> http://finance.groups.yahoo.com/group/amibroker/message/117998
> http://finance.groups.yahoo.com/group/amibroker/message/72151
>
> Is there a simple way to accomplish this? Otherwise, the trailing
> stops don't work correctly since HighestSince is reset with each
> succeeding Buy signal and vice versa for LowestSince. The below is
the
> code I'm looking to fix:
>
> ---
> Buy = Signal1 & Signal2;
> Short = Signal1Rev & Signal2Rev;
> Buy = Ref(Buy,-1);
> Short = Ref(Short,-1);
> BuyPrice = O;
> ShortPrice = O;
> SetTradeDelays(0,0,0,0);
>
> sellstopline = HighestSince( Buy, High ) * STrailingStopPct;
> BuyBarsSince = BarsSince(Buy == 1);
> sellprofitline = Ref(BuyPrice, -BuyBarsSince) * SProfitStopPct;
> sellex = sellstopline > P;
> sellex2 = P > sellprofitline;
> Sell= IIf(sellex,4,(IIf((sellex2),3,0)));
> SellPrice = O;
>
> coverstopline = LowestSince( Short, Low ) * BTrailingStopPct;
> ShortBarsSince = BarsSince(Short == 1);
> coverprofitline = Ref(ShortPrice, -ShortBarsSince) *
BProfitStopPct;
> buyex = P > coverstopline;
> buyex2 = coverprofitline > P;
> Cover= IIf(buyex==1, 4, (IIf((buyex2),3,0)));
> CoverPrice = O;
> Equity(1,0);
> --
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
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:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto: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/