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

[EquisMetaStock Group] Need help with formula



PureBytes Links

Trading Reference Links

Hello, I've come across this formula for Renko charts adjusted by 
ATR.  However, my metastock coding skills are rudimentary, so I'm 
not sure how to solve this problem.  If I read the manual correctly 
the If statement is only binary in function, meaning for one If 
statement there is one true/false outcome.  In the code below, there 
are multiple computation within an If statement, folloed by and End 
statement.  How  could this be coded properly in metatock.  Your 
help would be greatly appreciated.

TIA,
Gernot

Inputs: K(1),
Smooth(10);

vars:Brick(0), DN(0), UP(0), BricksUp(0), BricksDn(0);
Value1 = ATR(Smooth);

If BarNumber = 1 Then Begin
  Up = H;
  Dn = L;
  Brick = K*(H - L);
End;
If BarNumber > 1 then begin
  If C > UP + Brick Then begin
    BricksUp = IF(Brick = 0, 0, Floor((C - Up)/Brick)*Brick);
    UP = Up + BricksUp;
    Brick = K*Value1;
    DN = Up - Brick;
    BricksDn = 0;
  End;
  If C < Dn - Brick Then begin
    BricksDn = IF(Brick = 0, 0, Floor((Dn - C)/Brick)*Brick);
    Dn = Dn - BricksDn;
    Brick = K*Value1;
    Up = Dn + Brick;
    BricksUp = 0;
  End;
End;

Plot1(UP, "Up");
Plot2(DN, "Dn");





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

<*> 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/