logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
redrunner  
#1 Posted : Monday, July 31, 2006 7:57:04 AM(UTC)
redrunner

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/27/2006(UTC)
Posts: 24

[size=18:ecadf6ea1d]Dear Members,[/size:ecadf6ea1d] I am a new newbee here. I am trying to code Chandelier Exit with reducing ATR stop in function of reached profit. I know that Richard Dale has an excellent one but I want to code my own. It seems to be working but there are 2 problems: 1, Code is quite slow... CAN ANYONE FIX IT? 2, After droping this indicator to a chart (with merging, of course), its values are correct but not scaling. Stop loss indicator "finds" the right place only after a big zoom in or rescaling (stop loss is above and not below the chart before hitting that). Sometimes the same situation occured with Richard Dale's code as well... IS IT A MS SCALING BUG? [code:1:ecadf6ea1d] ============== Chandelier Exit ============== {----8<----------------------------- EntYR:=Input("Year",1980,2006,2006); EntMTH:=Input("Month",1,12,3); EntDY:=Input("Day",1,31,5); AvgTR:= Mov( ATR(1),20,S ); EntLong:= Year()=EntYR AND Month()=EntMTH AND DayOfMonth()=EntDY; PeriodFrom:=Year()>EntYR OR (Year()=EntYR AND (Month()>EntMTH OR Month()=EntMTH AND DayOfMonth()>=EntDY)); EntryPrice:= ValueWhen(1, EntLong, C); Mplier:= If( C=EntryPrice, 2, If( C < EntryPrice + 4*AvgTR, 3.5, If( C < EntryPrice + 6*AvgTR, 3, If( C >= EntryPrice + 6*AvgTR, 2.5, 0)))); HV:=Highest(ValueWhen(1, PeriodFrom, H)); StopLoss:=Ref(HV - Mplier*AvgTR, 0); StopActivated:= (C < StopLoss); State:= If( StopActivated, 1, PREV); If(Cum(1)=1, StopLoss, If(StopLoss >= PREV AND State=0, Stoploss, PREV)); {----8<-----------------------------[/code:1:ecadf6ea1d] Thanks for any help or suggestion redrunner
Jose  
#2 Posted : Monday, July 31, 2006 8:30:11 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
RedRunner, there is a bug there, but it has nothing to do with MetaStock of its formula language. ;) Try the ATR trailing stop from MetaStockTools.com. jose '-)
redrunner  
#3 Posted : Monday, July 31, 2006 12:43:40 PM(UTC)
redrunner

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/27/2006(UTC)
Posts: 24

Dear Jose, Thanks for your quick reply. I am sad a little bit because your code is too complex for me to understand and has no stop loss reduction function. If you have some free time, will you be so kind and post core part of your very well written parameterised code? Is TradeSim.dll available for free of charge? Thanks again. RedRunner
Jose  
#4 Posted : Monday, July 31, 2006 1:31:47 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
redrunner wrote:
...and has no stop loss reduction function.
Not so - all trailing stop parameters are available from the indicator's user inputs. I also offer more advanced trailing stop functions, but these are part of commercial packages. TradeSim.dll is only available with the purchase of TradeSim, but Richard Dale's Advanced Trailing Stop dll is free - you'll find basic trailing stop code examples there. jose '-)
redrunner  
#5 Posted : Tuesday, August 1, 2006 4:03:52 PM(UTC)
redrunner

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/27/2006(UTC)
Posts: 24

Dear Jose,

Thank you for help. I will start to study your code (and try to understand that...)

RedRunner

Jose  
#6 Posted : Wednesday, August 2, 2006 1:03:11 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
redrunner wrote:
I will start to study your code (and try to understand that...)
The best way to understand any code, is to pull it apart and plot it line by line. jose '-)
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.