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

Notification

Icon
Error

Options
Go to last post Go to first unread
b_dunn  
#1 Posted : Sunday, March 25, 2007 5:10:20 AM(UTC)
b_dunn

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/1/2005(UTC)
Posts: 11

Hi all:

I am trying to code an entry when there is a higher high than the high of the Signal's bar.

For example, Bar 1 has the Close cross above 50days SMA and that make it a Signal bar. But, I only want to enter the trade ONLY if there is a first occurence of a bar that has a High value One Tick higher than the Signal bar's High, either this bar is next to Signal bar or 30 bars away from the Signal bar.

Tried many methods but with no success.

So, seeking advise and assitance from the gurus and members here.

Thanx a lot!

- Bill

*PP  
#2 Posted : Sunday, March 25, 2007 6:02:05 AM(UTC)
*PP

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/1/2006(UTC)
Posts: 135
Location: Romania

here it is, if there is something wrong forgive me as i have not check it closely.

If(Cross(H,ValueWhen(1,If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0,H)) AND BarsSince(If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0)<BarsSince(If(C>Mov(C,50,S),1,0)=0 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=1) AND BarsSince(If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0)<=30,1,0)

it will plot a 1 every time high of the day will cross the high of the day when the close crossed above sma50 if it has not passed more than 30 bars from the crossover

:) good luck

b_dunn  
#3 Posted : Sunday, March 25, 2007 6:13:36 AM(UTC)
b_dunn

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/1/2005(UTC)
Posts: 11

hi *pp:

thanx for the reply.

i think i didnt expressed my question clearly.

pls allow me do so again here.

the main point is, it has to be the first occurence of a bar that has a High value One Tick higher than the Signal bar's High, and this can happen either on next bar or ANY bar away from the signal bar, provided/as long as that this is the FIRST occurence and the High of the bar is One Tick higher than the Signal's High. So, we only need ONE entry trade signal by the end.

Pls advise.

Thanx!

*PP  
#4 Posted : Sunday, March 25, 2007 7:43:22 AM(UTC)
*PP

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/1/2006(UTC)
Posts: 135
Location: Romania

a:=If(Cross(H,ValueWhen(1,If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0,H)) AND BarsSince(If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0)<BarsSince(If(C>Mov(C,50,S),1,0)=0 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=1) AND BarsSince(If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0)<=30,1,0);
b:=If(Cross(C,Mov(C,50,S)) AND Ref(BarsSince(Cross(C,Mov(C,50,S))),-1)>30,Cum(1),0);
If(ValueWhen(1,a=1,ValueWhen(1,b<>0 AND Ref(b,-1)=0,b))=ValueWhen(2,a=1,ValueWhen(1,b<>0 AND Ref(b,-1)=0,b)),0,a)

try this it might help; what i don`t know if what if there are a lot of crossovers one after another at intervals smaler than 30 bars? u want a signal after each crossover even if u have one after the previous crossover and there isn`t 30 bars since then?

the code above will ignore any crossover that happened at less than 30 since the previous one (hopefully)

the code bellow wil plot 1 after each crossover even if there is less than 30 from the previous one:

a:=If(Cross(H,ValueWhen(1,If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0,H)) AND BarsSince(If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0)<BarsSince(If(C>Mov(C,50,S),1,0)=0 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=1) AND BarsSince(If(C>Mov(C,50,S),1,0)=1 AND Ref(If(C>Mov(C,50,S),1,0)=1,-1)=0)<=30,1,0);
b:=If(Cross(C,Mov(C,50,S)),Cum(1),0);

If(ValueWhen(1,a=1,ValueWhen(1,b<>0 AND Ref(b,-1)=0,b))=ValueWhen(2,a=1,ValueWhen(1,b<>0 AND Ref(b,-1)=0,b)),0,a)

i hope that helps; i did not verified the code so i hope it is what u want if not i don`t have another ideea now, tell me if it works

uasish  
#5 Posted : Sunday, March 25, 2007 7:47:18 PM(UTC)
uasish

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 8/13/2005(UTC)
Posts: 170

Thanks: 7 times

Henry,

I do not know the requirement of b_dunn , but the 2nd code (giving 1 on each cross) can be tinkered to satisfy the XTL entry ( 50 % above the range of High bar) of A.Get or this signal may coincide with the 1st Blue Bar after the Blue Arrow of RMO,i have not verified.Thks.

Asish

wabbit  
#6 Posted : Sunday, March 25, 2007 8:13:21 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)
Bill and all,

Here's my take on the problem:

Code:

x:=C>Mov(C,50,S);
signal:=x and Alert(x=0,2);

count:=H>ValueWhen(1,signal,H);
count:=cum(count);

tr:=(count-valuewhen(1,signal,count))=1 and barssince(signal)>=1 and barssince(signal)<=30;
tr:=tr and Alert(Tr=0,2);

{plot}
tr;



Hope this helps

wabbit [:D]


b_dunn  
#7 Posted : Sunday, March 25, 2007 11:39:39 PM(UTC)
b_dunn

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/1/2005(UTC)
Posts: 11

wabbit wrote:
Bill and all,

Here's my take on the problem:

Code:

x:=C>Mov(C,50,S);
signal:=x and Alert(x=0,2);

count:=H>ValueWhen(1,signal,H);
count:=cum(count);

tr:=(count-valuewhen(1,signal,count))=1 and barssince(signal)>=1 and barssince(signal)<=30;
tr:=tr and Alert(Tr=0,2);

{plot}
tr;



Hope this helps

wabbit [:D]


Hi Wabbit & all,

Thanx for all the advise and codes.

Wabbit, on your codes, you are using the interger "30".

What I meant is, the actual entry bar could be ANY bar after the signal bar, it could be 10bars away, 60bars away or 5bars away or etc, just ANY bar that met the requirement (as long as this is the FIRST occurence of the One Tick Higher Than the High of the Signal's bar), and we only need ONE actual entry signal. And also, I would like to make it as a day trading system. 30bars could be fine for 1min time chart, but 30bars could be appeared on next day under 15min/30min time chart and that become invalid.

Sorry for making all these complicated, guys. And many thanx for the valuable time for all.

Pls help. TIA!

- Bill

wabbit  
#8 Posted : Monday, March 26, 2007 3:09:37 AM(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)

OK... so just take out the references to the barssince:


Code:

x:=C>Mov(C,50,S);
signal:=x and Alert(x=0,2);

count:=H>ValueWhen(1,signal,H);
count:=cum(count);

tr:=(count-valuewhen(1,signal,count))=1;
tr:=tr and Alert(Tr=0,2);

{plot}
tr;



Hope this helps

wabbit [:D]


uasish  
#9 Posted : Monday, March 26, 2007 6:42:03 AM(UTC)
uasish

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 8/13/2005(UTC)
Posts: 170

Thanks: 7 times

Wabbit,

Neat.

Asish

wabbit  
#10 Posted : Monday, March 26, 2007 6:59:02 AM(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)
Thanks. No need to over-complicate things...


wabbit [:D]



b_dunn  
#11 Posted : Monday, March 26, 2007 8:19:21 AM(UTC)
b_dunn

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/1/2005(UTC)
Posts: 11

Thanx Wabbit!

Cant thank u enough!

wabbit  
#12 Posted : Monday, March 26, 2007 10:02:17 AM(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)
Said a street performer to the audience, "Don't applaud, throw money!"


wabbit [:D]



*PP  
#13 Posted : Monday, March 26, 2007 10:37:15 AM(UTC)
*PP

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/1/2006(UTC)
Posts: 135
Location: Romania

wabbit wrote:
Said a street performer to the audience, "Don't applaud, throw money!"


wabbit [:D]



:))

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.