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

Notification

Icon
Error

Options
Go to last post Go to first unread
biandi  
#1 Posted : Monday, December 3, 2007 2:17:02 AM(UTC)
biandi

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/23/2007(UTC)
Posts: 25

Hello I must create an indicator that tells me:
If the closure is close to three times greater than mov (c, 50, w) then +1, -1;
hayseed  
#2 Posted : Wednesday, December 5, 2007 6:33:28 AM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey biandi..... seems something is missing in your sentence, If the closure is close to three times greater than mov (c, 50, w) .....

unless we are talking about penny stocks, it would rare for the closing price to ever be 3 times the moving average .....h

biandi  
#3 Posted : Thursday, December 6, 2007 5:55:38 AM(UTC)
biandi

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/23/2007(UTC)
Posts: 25

Ok no that if I want closure remains above its average for more than three times +1 if no -1
hayseed  
#4 Posted : Thursday, December 6, 2007 7:12:03 AM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey biandi....... there are several ways to code that.... the 'barsince' function would be one way..... it has always been easier for me to use functions that are easy to visualize.... barssince is a perfect example.....

below is a quick shot where the moving average periods is adjustable and also your 'three times' limit setting..... just in case you might want to close above ma for 10 times.....

have you thought of perhaps using 1 and 0 instead of +1 and -1..... maybe then you could incorporate the close less than moving average into the same indicator.... 1 when it's above and -1 when it's below..... just a thought......h

//-----------------------------

pds:=Input("periods",2,100,50);
limit:=Input("bars since close",1,200,3);

a:= C < Mov(C,pds,S);


If( BarsSince(a ) > limit,1,-1) {instead of -1 maybe 0}

//-----------------------------

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.