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

Re: [amibroker] Plot ATR trailing stop which only increases



PureBytes Links

Trading Reference Links

Andrew,
 
Greetings.
 
This is based on the chandlier inthe library. So credit goes to G Muhali.
 
Use valuewhen to get the start value from your buy signal using barindex.
_SECTION_BEGIN("Chandelier Exit");

YourHold_Buy = BarIndex() - ValueWhen(SwingTrade_Strategy3_Buy, BarIndex(), 1);//Replace <...> with your 'buy' formula

YourHold_Sell = BarIndex() - ValueWhen(SwingTrade_Strategy3_Sell, BarIndex(), 1);

Multiple = 3; //How many ATR?s to be allowed below the highest high since latest "buy" bar

ATRPeriods = 20; //How many periods to use for the ATR

Chandelier_TS_FOR_LONGPOSITIONS = HHV(Close,YourHold_Buy) - (Multiple * ATR(ATRPeriods)); //Chandelier exit line from highest close

Chandelier_TS_FOR_SHORTPOSITIONS = LLV(Low, YourHold_Sell) + (Multiple * ATR(ATRPeriods)); //Chanderlier exit from lowest low (used when going short)

Plot(Chandelier_TS_FOR_LONGPOSITIONS, "ChandClose", ParamColor( "ChandClose Color", colorViolet ), ParamStyle("ChandClose Style") );

Plot(Chandelier_TS_FOR_SHORTPOSITIONS, "ChandLow", ParamColor( "ChandLow Color", colorAqua ), ParamStyle("ChandLow Style") );

"YourHold_Buy is "+YourHold_Buy;

"ATR20 IS "+ATR(20);

"hhv_buyhold is "+HHV(Close,YourHold_Buy);

_SECTION_END();///////

Cheers,Padhu

 

----- Original Message -----
Sent: Thursday, November 22, 2007 1:39 AM
Subject: [amibroker] Plot ATR trailing stop which only increases

Hi,

I've been trying to crack this one but can't seem to. What I need is a
plot of my trailing stop. The stop is based on a multiplier of todays
ATR(30) value. This stop only ever increase.

Can anyone help me out with some code please?

Thanks

Andrew

__._,_.___

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

__,_._,___