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

Notification

Icon
Error

Options
Go to last post Go to first unread
dct73  
#1 Posted : Sunday, July 26, 2009 12:57:21 PM(UTC)
dct73

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 7/26/2009(UTC)
Posts: 7

I have a simple long only entry (C-Ref(C,-60))/ATR(60)>10 and MOV(V,30,S)>50000 and C>MOV(C,200,S) and am trying to cut and paste the chandelier exit from Jose as shown below

{ User Inputs }
multi:=Input("ATR multiplier",0,10,2.5);
pds:=Input("ATR periods",1,252,10);
pds1:=Input("ATR lookback periods",1,252,21);
plot:=Input("[1]Trailing Stop, [2]Long+Short, [3]Signals",1,3,1);
adv:=Input("plot: today's trailing stop=0, tomorrow's stop=1",0,1,0);
delay:=Input("Entry and Exit signal delay",0,5,0);

{ Trailing Stops }
StLong:=HHV(C-multi*Mov(ATR(1),pds,E),pds1);
StShort:=LLV(C+multi*Mov(ATR(1),pds,E),pds1);
stopLong:=If(C<PREV,StLong,Max(StLong,PREV));
stopShort:=If(C>PREV,StShort,Min(StShort,PREV));

into the "Sell Order" tab. I keep getting an error stating "This function is not allowed
in this type of formula." The cursor then blinks in front of "Input ("ATR multiplier",0,10,2.5);

Would somebody please give a newbie a hand?

Thanks

wabbit  
#2 Posted : Sunday, July 26, 2009 8:23:39 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Hi dct,

Welcome to the Forum.

The Input() function can only be used in indicators; it cannot be used in Explorations, Experts or System Tests.

Replace the Input() function by simply assigning the value you want to use to the variable e.g.

Instead of

Code:
multi:=Input("ATR multiplier",0,10,2.5);


use

Code:
multi:=2.5;



Hope this helps.

wabbit [:D]




dct73  
#3 Posted : Monday, July 27, 2009 12:44:05 PM(UTC)
dct73

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 7/26/2009(UTC)
Posts: 7

Thanks. Then it appears most of that code is unnecessary. Is this all I need to trigger a sell?

multi:=2.5;
pds:=10;
pds1:=21;
{ Trailing Stops }
StLong:=HHV(C-multi*Mov(ATR(1),pds,E),pds1);
C<StLong;

I feel I'm missing something in this line I left out:
"StopLong: = If(C<PREV,StLong,Max(StLong,PREV));"

Correct me if I'm wrong,
If C<Prev, then StopLong=StLong
If C>=Prev, then StopLong= the greater of StLong and Prev. Does this "Prev" apply to StLong or StopLong? I just can't understand why I need this line.

dct73  
#4 Posted : Monday, July 27, 2009 1:05:30 PM(UTC)
dct73

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 7/26/2009(UTC)
Posts: 7

Wow. I'm really missing the boat here. With what I have if I enter on a dip, my entry could be below my stop! How do I keep the HHV from looking back previous to my entry?
wabbit  
#5 Posted : Monday, July 27, 2009 5:48:48 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Although the Chandelier Exit is a great programming exercise in MS, you are missing some of the critical concepts in the execution of your version; I don't have time this morning to go through them all, suffice to say check out Richard Dale's Advanced Stops solution at http://www.tradernexus.com/
dct73  
#6 Posted : Monday, July 27, 2009 8:29:07 PM(UTC)
dct73

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 7/26/2009(UTC)
Posts: 7

Thanks wabbit. That's a great link.


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.