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

Notification

Icon
Error

Options
Go to last post Go to first unread
empu  
#1 Posted : Friday, May 3, 2013 7:41:42 PM(UTC)
empu

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/3/2009(UTC)
Posts: 12

Friends,

I like to explore security which explaining the last value position compare to Peak or Trough. I want to know, the current stock price is going down after Peak or going up after Trough. I tried with

Variation:=0.001;
up:=Peak(1,C,Variation);
dn:=Trough(1,C,Variation);
zup:=Ref(up,-1);
zdn:=Ref(dn,-1);
Cross(C,zdn) or Cross(zup,C)

but the result is poor.

haddison  
#2 Posted : Thursday, May 16, 2013 2:18:18 PM(UTC)
haddison

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/6/2010(UTC)
Posts: 113
Location: London

Could you be more specific when you say the results are poor?
What is wrong with it?
wabbit  
#3 Posted : Thursday, May 16, 2013 10:14:34 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)
I think your Cross() functions are around the wrong way?

Predicting ahead to defining what I think you want but you didn't ask for :(

Code:

Variation:=0.001;
up:=Peak(1,C,Variation);
dn:=Trough(1,C,Variation);
zup:=Ref(up,-1);
zdn:=Ref(dn,-1);

test:=Cross(C,zup) OR Cross(zdn,C);

count:=cum(test);
reset:=peakbars(1,C,Variation)=0 or troughbars(1,C,Variation)=0;
counter:=count-valuewhen(1,reset,count);

{plot discrete signals}
counter=1 and alert(counter<>1,2);


????

untested code: and I'd never trade anything using Peak(), Trough() or similar hindsight based indicators without fully understanding how they work!


wabbit [:D]

haddison  
#4 Posted : Friday, May 17, 2013 9:03:12 AM(UTC)
haddison

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/6/2010(UTC)
Posts: 113
Location: London

Pardon my misunderstanding, but in the code above, isn't the peak or trough detected the bar after when it is actually formed? How would that be hindsight?

Thanks.
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.