home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / TRUEG.TAS < prev    next >
Text File  |  1992-03-15  |  3KB  |  96 lines

  1. { Written by Jim Camenos, May 31, 1991, Prodigy code VNGH10A
  2.   This program attempts to determine the True Trading Range over the past
  3.   3 months.  It then calculates the standard deviation of the range and
  4.   calculates the number and percentage the True Trading Range occurred
  5.   within 1 standard deviation, 2 standard deviations, 3 standard deviations
  6.   and over.  The higher % in 1 standard deviation, eg, 90%++, indicates
  7.   the underlying equity to be non-volitable.  Higher percentages in 2,3 or
  8.   over 3 standard deviations are more volitable issues.  Stocks trading high
  9.   % in their 1 std deviation will be trading options with lower premium than
  10.   those with lower percentages.  Interesting that AMGN average True Trading
  11.   Range for the past 3 months is $5 and has traded 87% within its 1 std
  12.   deviation and 9% within 2 std deviations.  The std deviation is $3, theref
  13. ore
  14.   AMGN would have a trading range between $2-$8 daily and 9% or 1 out of eve
  15. ry
  16.   11 trading days the range would be in a $12 range.  Check the TAS referanc
  17. e
  18.   manual for the definition of True Trading Range.
  19. }
  20. { Modified 3/15/92 adds graphics, analyizes volatility, and ma crossovers}
  21. #max_quotes 200
  22. #OUTPUT_FILE 'TRUEG.LST'
  23. adr : array;
  24. adr = ad();
  25. ada : array;
  26. adb : array;
  27. ada = mov(adr,5,'e');
  28. adb = mov(adr,13,'e');
  29. adn : array;
  30. adn = sub(ada,adb);
  31. m8 : array;
  32. m8 = mov(v,21,'e');
  33. m13 : array;
  34. m13 = mov(v,34,'e');
  35. m813 : array;
  36. m813 = sub(m8,m13);
  37. c5 : array;
  38. c5 = mov(c,13,'e');
  39. c35 : array;
  40. c35 = mov(c,35,'e');
  41. tdy = tr();
  42. tx: array;
  43. tx=TR();
  44. x := quote_count-1;       { load max(66,num of quotes in file) MM 6/5}
  45. avg_tr = sum(tx,x)/x;
  46. sd = std(tx,x);
  47. gosub true_range;
  48. if first_ticker then
  49.  begin
  50.  writeln('Read your charts before making any investment decisions\n\n');
  51.  writeln
  52. ('                           Trading   1 STD    1 STD()     2     3    STD')
  53. ;
  54.  writeln
  55. ('                            Range     Dev   Days   0/0   STD   STD');
  56.  end;
  57. star = ' '
  58. if tdy>avg_tr then
  59.  star='*'
  60. writeln(ticker,' ',fullname,avg_tr,' ',sd,int(sd1),' ',int((sd1/x)*100),'%',
  61. int((sd2/x)*100),'%',int((sd3/x)*100),'%',tdy,star); {int((sd4/x)*100),'%');
  62. }
  63. if tdy>avg_tr {or tdy>tx[-1]} then
  64.   gosub graphit;
  65. return;
  66. :graphit
  67. begin
  68. OPENGRAPH(4);
  69. sizegraph(6,2,2,2);
  70. GRAPH(1,'Avg Trng Rrge: '+format(avg_tr,'%4.2f')+'   Tdy Rnge: '
  71. +format(tdy,'%4.2f')+
  72. '  Prev: '+format(c[-1],'%7.3f')+
  73. '  Tdy: '+format(c[0],'%7.3f')+
  74. '  DTR: '+format(tdy,'%5.2f'),c5,c35);
  75. GRAPH(v,'Volume');
  76. graph(m813,'Volume Oscillator - Over "0" Line: Volume 13 Weeks > 34 Weeks');
  77. graph(adn,'Accumulation/Distribution Oscillator');
  78. CLOSEGRAPH();
  79. end;
  80. :true_range
  81. begin
  82. a = 1;
  83. sd1 = 0;
  84. sd2 = 0;
  85. sd3 = 0;
  86. sd4 = 0;
  87. :true_r
  88. if a > x then return;
  89. if (avg_tr-sd) <= tx[a] and ((avg_tr+sd)>=tx[a]) then sd1 = sd1+1 else
  90. if (avg_tr-(sd*2))<=tx[a] and ((avg_tr+(sd*2))>=tx[a]) then sd2=sd2+1 else
  91. if (avg_tr-(sd*3))<=tx[a] and ((avg_tr+(sd*3))>=tx[a]) then sd3=sd3+1 else
  92.        sd4 = sd4+1;
  93. a = a+1;
  94. goto true_r;
  95. end;
  96.