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

[EquisMetaStock Group] Re: Stuck In The Mud


  • Date: Tue, 15 Dec 2009 12:52:59 -0000
  • From: pumrysh <no_reply@xxxxxxxxxxxxxxx>
  • Subject: [EquisMetaStock Group] Re: Stuck In The Mud

PureBytes Links

Trading Reference Links

D,

Without knowing the definition of var1 and var2 there is little that I can offer to help you. There may be a simple solution to your problem but until I know what you are using for those variables I am lost.

You did mention a fail to load when you tried prev. Is there an error message or do you get a zero value?

The way your formula is written, if the "then" clause equates to a zero value you are likely to get a horizontal zero across your chart. If that is the case then try switching to this:

DSRR:=If(Ref(Var1,-1) > Ref(Var2,-1) AND Var1 < Var2,
{then}Prev,
{else}HHV(High,10));


Wish I could offer more but without knowing the definition of var1 and var2 I'm limited.


Preston
 






--- In equismetastock@xxxxxxxxxxxxxxx, Mr Distinque <distinque@xxx> wrote:
>
> 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@ ..> 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
> >
>




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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    equismetastock-digest@xxxxxxxxxxxxxxx 
    equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/