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.
|
|
|
|
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?
|
|
|
|
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]
|
|
|
|
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.