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

Notification

Icon
Error

Options
Go to last post Go to first unread
robpettit  
#1 Posted : Monday, June 18, 2012 10:39:58 AM(UTC)
robpettit

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/14/2012(UTC)
Posts: 8

Hi, is it possible in an indicator, to not plot result until there is a min number of prices. Eg only plot the difference between an average and close price if there is x number of price data. regards robert
haddison  
#2 Posted : Monday, June 18, 2012 12:56:28 PM(UTC)
haddison

Rank: Advanced Member

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

Yes it is possible. If you want the bar number then use Cum(1) in your code.
robpettit  
#3 Posted : Monday, June 18, 2012 1:19:44 PM(UTC)
robpettit

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/14/2012(UTC)
Posts: 8

thanks for your reply, Ill give it ago. In the mean time Im using 'If(ref(c,-x),indicator,indicator) which seems to work. Regards Robert
mstt  
#4 Posted : Monday, June 18, 2012 1:37:58 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Rob

ValueWhen(1, Cum(1)>"X", "Signal") is what I use.

Roy
robpettit  
#5 Posted : Monday, June 18, 2012 2:00:49 PM(UTC)
robpettit

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/14/2012(UTC)
Posts: 8

hi, like it, much easier to read and understand. Is it possible to reverse it so signal stops before x points from end? Regards Robert
mstt  
#6 Posted : Monday, June 18, 2012 2:55:18 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Robert

Yes it's possible but until someone comes up with a better way it requires two Ref() functions. It goes something like this.

{Inhibit right-side plot by "Shift" bars}
{LastValue() needed for a calculated number}
Shift:=LastValue("number");
Ref(Ref("Signal",-Shift),Shift);

This method makes use of the fact that MetaStock processes innermost functions of an expression first. In this case that's a shift of "Signal" to the right by -Shift bars (delayed if you prefer that terminology), thus discarding "number" bars from "Signal". Then "Signal", now devoid of the rightmost "number" of data bars, is shifted (advanced) to the left. The net effect is that the last "Shift" bars of "Signal" now return N/A rather than the original value. Obviously if the shift value is simply a number then there's no need to wrap it in LastValue().

Hope this helps.

Roy
Users browsing this topic
Guest (Hidden)
Similar Topics
How I can test Moving Average/Price Breakout - 5min data & I need 15min & 20min test? (Data Related Questions)
by dacha 5/27/2008 6:35:32 AM(UTC)
MetaStock Pro System Test needed for 1 and 5 min data (MetaStock)
by miltfall 2/24/2007 8:30:42 PM(UTC)
Converting 5 min data to 1 hour data (Data Related Questions)
by PLAS 12/14/2005 11:33:59 AM(UTC)
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.