[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] Re: Stuck In The Mud


  • Date: Mon, 14 Dec 2009 13:53:00 -0800 (PST)
  • From: Mr Distinque <distinque@xxxxxxxxx>
  • Subject: Re: [EquisMetaStock Group] Re: Stuck In The Mud

PureBytes Links

Trading Reference Links



Not really, but I do thank you for your input.
 
I fully understand the if() statement and have no issues with it.  The problem appears to be in the Ref() statement on initial loading.
 
Also tries the PREV, it failed to load.
 
I have got my piviot lines to be non-connected, but they are date driven.  Will have to figure out something similar to those.
Sure would be nice to have a step-thru debugger that would let us see the data values.  While I am wishing a Switch statement and a For loop would be fantastic.
 
As much as I love MetaStock, IMHO they have really dropped the ball on updating the programming lauguage.
D
EGO Sum Qua EGO Sum

"A corporation's primary goal is to make money. Government's primary role is to take a big chunk of that money and give it to others." —Larry Ellison


--- On Mon, 12/14/09, pumrysh <no_reply@xxxxxxxxxxxxxxx> wrote:

From: pumrysh <no_reply@xxxxxxxxxxxxxxx>
Subject: [EquisMetaStock Group] Re: Stuck In The Mud
To: equismetastock@xxxxxxxxxxxxxxx
Date: Monday, December 14, 2009, 12:21 PM

 
distinque,

Remember that the help file has tons of information. You can find it at the top left when your program is opened under the "help" icon.

Here's what it says about the If function:

The if() function is used to create conditional (i.e., "if-then") statements. It is perhaps the most used function in the MetaStock formula language. It contains three parameters as shown in the following example.
if( close > mov(c,10,s), rsi(9), rsi(14) )
The above "if" statement reads (in English) as follows: If today's close is greater than today's 10-day simple moving average of the close, then plot a 9-day RSI, otherwise, plot a 14-day RSI.

The next formula plots "positive volume" if the close is greater than the median price. Otherwise, "negative volume" is plotted.

if( CLOSE > (HIGH+LOW)/2, +V, -V )

A good example of the if() function can be found in the On Balance Volume example (see On Balance Volume).

If you simply want an _expression_ to be evaluated as either true or false, it can be done without the use of the if() function. The following formula will result in either a 1 (true) or a 0 (false).

rsi(14) > 70

If the 14-period RSI is greater than 70, then this formula will evaluate to "true" and return the number 1. If it is below 70, the formula will evaluate to "false" and return the number 0. This is done without the if() function being used. The formula below uses the if() function and will return the same results, but it is longer.

if(rsi(14) > 70, 1, 0 )

------------ --------- --------- --------- ---

So the syntax is If(condition, then,else)

Something like this works

A:= HHV(HIGH,10) ;
If(a > Ref(a,-1),a, PREV)

or

A:= HHV(HIGH,10) ;
If(a > Ref(a,-1),a, Ref(a,-1) );

but I don't know what you are using for Var1 or Var2 so I really have no way of telling if this is what you are looking for.

Also, using the prev function is really not the way to go as it slows down the calculation process.

Hope this helps,

Preston

--- In equismetastock@ yahoogroups. com, "distinque" <distinque@x ..> wrote:
>
> I am working on bringing some of my MT4 code over to Metastock and have hit a snag (aka - Slow brain cell).
>
> I need to reference a preceding varible value. Current code is:
>
> DSRR:=If(Ref( Var1, -1) > Ref(Var2, -1) AND Var1 < Var2, Var3 = HHV(HIGH,10) ,Problem Here);
>
> I have tried
> Var3=PREV
> AND
> Var3 = Ref(Var3,-1)
>
> Neither work. I have also tried assigning a value before the if statement. Does not work properly.
>
> What I would like is to create a straight line the is based on the HHV for 10 days. When the if statement fails I want the previous value of a rolling window which has the HHV for 10 days. Basicly this should create a flat line that runs until the if statement is true and a new line level is set.
>
> Thanks
>




__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___