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

Help converting TS code to MetaStock



PureBytes Links

Trading Reference Links

I hope someone can help me with trying to "translate" the attached
TradeStation code (x2) to MetaStock 6.5 code and save me many hours learning
MS code. 

Many thanks!
Dan Poiree
Bellingham WA
**********
vars:  x(0), y(1), z(0);

x = x[1] + 0.5 * (C Data5 - x[1]);
y = highest(x, 40) - lowest(x, 40);
if y > 0 then z = 100 * ((x - lowest(x, 40)) / y ) - 50;

plot1(z,"ST");
plot2(-11.5,"B");
plot3(31,"S");
**********

vars: ADRrs(0), ADRstr(0), djcstr(0), adrx(0), hhv(0), llv(0), ii(0);

  adrx = adrx[1] + 0.2 * (((C Data2 - C Data3) / (C Data2 + C Data3)) -
adrx[1]);
  hhv = adrx; 
  llv = adrx;
  for ii = 1 to 5 begin
     if adrx[ii] > hhv then hhv = adrx[ii]; 
     if adrx[ii] < llv then llv = adrx[ii];
  end; {for loop}
  if (hhv - llv) > 0 then ADRstr = 100 * ((adrx - llv) / (hhv - llv)) - 50;

ADRrs = 0;
if currentbar > 6 then begin
  hhv = C Data6; 
  llv = C Data6;
  for ii = 1 to 5 begin
     if (C Data6)[ii] > hhv then hhv = (C Data6)[ii]; 
     if (C Data6)[ii] < llv then llv = (C Data6)[ii];
  end; {for loop}
  djcstr = 0; 
  if (hhv - llv) > 0 then djcstr = 100 * ((C Data6 - llv) / (hhv - llv)) - 50;
  ADRrs = ADRstr - djcstr;
end;{>6dys}
{===================================================}
plot1(ADRrs,"ADRrs");
plot2(0,"Brs");
plot3(-30,"Srs");