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

Notification

Icon
Error

Options
Go to last post Go to first unread
ketal  
#1 Posted : Thursday, July 17, 2014 11:26:49 PM(UTC)
ketal

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/7/2014(UTC)
Posts: 17

Thanks: 6 times
Hi,

Request to please help with the code for the following condition:-
I want to highlight the bar whose range (high to low) has engulfed either the close OR the open of next 4 bars.
Kindly help with the code.

Regards,
K
MS Support  
#2 Posted : Friday, July 18, 2014 1:36:49 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,953

Thanks: 91 times
Was thanked: 155 time(s) in 150 post(s)
ketal wrote:
Hi,

Request to please help with the code for the following condition:-
I want to highlight the bar whose range (high to low) has engulfed either the close OR the open of next 4 bars.
Kindly help with the code.

Regards,
K

There's probably simpler ways to write this but you could try:

X:=Ref(H,-4);
Y:=Ref(L,-4);
Z:=((C < X AND C > Y) OR (O < X AND O > Y)) AND ((Ref(C,-1) < X AND Ref(C,-1) > Y) OR (Ref(O,-1) < X AND Ref(O,-1) > Y)) AND ((Ref(C,-2) < X AND Ref(C,-2) > Y) OR (Ref(O,-2) < X AND Ref(O,-2) > Y)) AND ((Ref(C,-3) < X AND Ref(C,-3) > Y) OR (Ref(O,-3) < X AND Ref(O,-3) > Y));
Ref(Z,4)
ketal  
#3 Posted : Saturday, July 19, 2014 2:11:56 AM(UTC)
ketal

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/7/2014(UTC)
Posts: 17

Thanks: 6 times
MS Support wrote:
ketal wrote:
Hi,

Request to please help with the code for the following condition:-
I want to highlight the bar whose range (high to low) has engulfed either the close OR the open of next 4 bars.
Kindly help with the code.

Regards,
K

There's probably simpler ways to write this but you could try:

X:=Ref(H,-4);
Y:=Ref(L,-4);
Z:=((C < X AND C > Y) OR (O < X AND O > Y)) AND ((Ref(C,-1) < X AND Ref(C,-1) > Y) OR (Ref(O,-1) < X AND Ref(O,-1) > Y)) AND ((Ref(C,-2) < X AND Ref(C,-2) > Y) OR (Ref(O,-2) < X AND Ref(O,-2) > Y)) AND ((Ref(C,-3) < X AND Ref(C,-3) > Y) OR (Ref(O,-3) < X AND Ref(O,-3) > Y));
Ref(Z,4)

Hi,

Thanks, it worked well.

Regards,
K
Users browsing this topic
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.