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

TS formula to convert decimals to 32nds



PureBytes Links

Trading Reference Links

Dear Rt'ers,

In response to a few questions on converting decimals to 32nds, here
is a Tradestation Indicator which does just that.

When you do a "Format Analysis Technique" of the indicator (this is
for TS 4.0), simply type in the numbers in decimals for Inputs 1, 2
or 3. The conversion to 32nds will be printed in the Print Log window.

Tradestation EasyLanguage Formula is below.


Frank
****************

input:oneday(1),price1(0),price2(0),price3(0);

if price1<>0 or price2<>0 or price3<>0 then begin

if date=currentdate or oneday=0 then begin
print(date:6:0,"  WT QuickCalc");

if price1<>0 and round(fracportion(price1)*32,0) >9 then
print(price1," =
",intportion(price1):3:0,"^",round(fracportion(price1)*32,0):2:0);
if price1<>0 and round(fracportion(price1)*32,0) <10 then
print(price1," =
",intportion(price1):3:0,"^0",round(fracportion(price1)*32,0):1:0);

if price2<>0 and round(fracportion(price2)*32,0) >9 then
print(price2," =
",intportion(price2):3:0,"^",round(fracportion(price2)*32,0):2:0);
if price2<>0 and round(fracportion(price2)*32,0) <10 then
print(price2," =
",intportion(price2):3:0,"^0",round(fracportion(price2)*32,0):1:0);

if price3<>0 and round(fracportion(price3)*32,0) >9 then
print(price3," =
",intportion(price3):3:0,"^",round(fracportion(price3)*32,0):2:0);
if price3<>0 and round(fracportion(price3)*32,0) <10 then
print(price3," =
",intportion(price3):3:0,"^0",round(fracportion(price3)*32,0):1:0);

print("");
end;

if value10<>0 then plot1(h,"");

end;