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

Notification

Icon
Error

Options
Go to last post Go to first unread
vladimir  
#1 Posted : Monday, April 18, 2011 11:28:50 PM(UTC)
vladimir

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/1/2007(UTC)
Posts: 33

Hi

My exploration aim for the
following

1) Within a date range
2) Month periodicity
3) Using max load data of 32767
4) Month chart got 2 MA.
5) any candlestick must cut upper MA
after that, any candlestick must cut lower MA
after that, any candlestick must cut upper MA again.

When run, some result show some candlestick body
actually didn't cut the MA at all, but only
their shadow does.

How can I ensure that the candlestick body
actually cut the MA in my code.

Filter Code in exploration
=================
ValueWhen(1, Cross(C,Mov(H,10,S)), C)
AND
ValueWhen(1, Cross(Mov(L,10,S),C), C)
AND
ValueWhen(2, Cross(C,Mov(H,10,S)), C)
AND
ExtFml("forum.DateRange", 20080101,20110401)



Thank you
wabbit  
#2 Posted : Tuesday, April 19, 2011 4:42:04 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)
If you ignore the direction of the candle, the body is:
Code:

top:=max(o,c);
bot:=min(o,c);


so, if you're looking for the value of the MA to be between these values:
Code:

top:=max(o,c);

bot:=min(o,c);
ma:=mov(c,10,s); {or whatever you want to use}

{plot/filter}
ma<top and ma>bot;



wabbit [:D]

vladimir  
#3 Posted : Tuesday, April 19, 2011 5:37:25 AM(UTC)
vladimir

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/1/2007(UTC)
Posts: 33

Hi Wabbit,

Thank alot for your guidance in this area.
However, after implementing the code as shown
in the filter below, my result is always 0.

Not sure why, any advise.

Thank you

(ValueWhen(1, Cross(C,Mov(H,10,S)), C)
AND (Mov(H,10,S) < Max(O,C) AND Mov(H,10,S) > Min(O,C)))
AND
(ValueWhen(1, Cross(Mov(L,10,S),C), C)
AND (Mov(L,10,S) < Max(O,C) AND Mov(L,10,S) > Min(O,C)))
AND
(ValueWhen(2, Cross(C,Mov(H,10,S)), C) AND
(Mov(H,10,S) < Max(O,C) AND Mov(H,10,S) > Min(O,C)))

wabbit  
#4 Posted : Tuesday, April 19, 2011 6:19:38 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)
In English, what is this system supposed to be returning?

wabbit [:D]

vladimir  
#5 Posted : Tuesday, April 19, 2011 8:27:41 AM(UTC)
vladimir

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/1/2007(UTC)
Posts: 33

Hi

In short, it should fulfill the following

1.Within the given period
2.1 or more candlesticks cut upper MA,
follow by 1 or more candlestick cut lower MA,
then follow by 1 more candlestick cut upper MA again, like
a zigzap.

Sorry if my explanation is poor.


wabbit  
#6 Posted : Tuesday, April 19, 2011 10:39:26 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)
I still don't quite understand, but hopefully this will get you closer?

Code:

top:=Max(O,C);
bot:=Min(O,C);

maH:=Mov(H,10,S);
maL:=Mov(L,10,S);

maHCutsCandle:=maH < top AND maH > bot;
maLCutsCandle:=maL < top AND maL > bot;

{order of events,
there are many ways to do this, this is just one way}
counter:=cum(1);
event1:=ValueWhen(1, maHCutsCandle, counter);
event2:=ValueWhen(1, maLCutsCandle, counter);
event3:=ValueWhen(2, maHCutsCandle, counter);

{plot/return}
event1 > event2 and
event2 > event3;


There is some redundancy in this logic, so you can achieve similar results with:

Code:

top:=Max(O,C);
bot:=Min(O,C);

maH:=Mov(H,10,S);
maL:=Mov(L,10,S);

maHCutsCandle:=maH < top AND maH > bot;
maLCutsCandle:=maL < top AND maL > bot;

{plot/return}
barssince(maHCutsCandle)<barssince(maLCutsCandle)



wabbit [:D]



vladimir  
#7 Posted : Tuesday, April 19, 2011 11:36:18 PM(UTC)
vladimir

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/1/2007(UTC)
Posts: 33

Hi wabbit

Thank a lot, it working fine and what I expecting.

Thank for the help and guidance, I learn a lot
from your code.





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.