[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Q regarding removing succeeding signals from HighestSince or LowestSince


  • To: <amibroker@xxxxxxxxxxxxxxx>
  • Subject: [amibroker] Re: Q regarding removing succeeding signals from HighestSince or LowestSince
  • From: "Gordon Sutherland" <gosuth@xxxxxxxxxx>
  • Date: Sat, 26 Jan 2008 15:41:37 +1300

PureBytes Links

Trading Reference Links

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/

 

__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Attachment: Description: application/msdownload

/* CHANDELIER EXIT Geoff Mulhall 24 Oct 2004
(Refer Folder:\GBS Notes\Chandelier Exits\Chandelier Zip - GBS)
---------------------------------------------------------------

Vers 1.02 - Improvements to problem data handling. Thks to James Kung

The chandelier exit is described at Chuck Le Beau's System Traders Club. Refer :

http://traderclub.com/cgi-bin/discus/show.cgi?107/107

If you are not familiar with the Chandelier Exit please refer to that site
before continuing.

The plugin provided here is a true Chandelier Exit ie it is always hung from
the highest high or highest close not as in the compromise version below which
readers may have seen else where ie
 
 Chandelier = HHV(High - 3 * ATR(15),10);    // Long Trade Exit
 Chandelier = LLV(Low  + 3 * ATR(15),10);    // Short Trade Exit
 
As you will see from the PNG file attached the plugin provides a single function
 which can be used for both short and long trades. 
 This is achieved by flipping whenever the close pierces the exit.
 
To plot a Chandelier exit hung from the close code as follows - 

Plot(ChandelierCl(ATR(15),3),"ChandelierCl",colorBlue,styleLine);

To plot a Chandelier exit hung from the high or low code as follows -

Plot(ChandelierHL(ATR(15),3),"ChandelierHL",colorRed,styleLine);  

Note both functions accept two parameters
1. The ATR array - in this case a 15 period - in this example ATR(15)  and
2. The ATR multiplier - in this example 3

A trading system can be built using the functions provided as follows

Buy  = Close > Ref( ChandelierCl(ATR(15),3), -1);
Sell = Close < Ref( ChandelierCl(ATR(15),3), -1);

Note the ref function is required due to the way the exit switches 
between a long and short trade.

To install the the plugin 
1. Shut down Amibroker
2. Copy the file Chandelier.dll to C:\Program Files\Amibroker\Plugins
3. Restart Amibroker (You will get a warning message that a new plugin
   has been installed).
   
 

  

Attachment: Description: Binary data

Attachment: chandelier.png
Description: PNG image