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

  1. {Martin below is KST script we've talked about.  I think you or your      }
  2. {customers may find it interesting.  David S. Landry, *P* MMMJ96A         }
  3. { This script displays three KST indicators: the short, immed., and long  }
  4. { The "Know Sure Thing" was developed by Martin Pring.  It takes 4 rate   }
  5. { of changes smoothes and weights them for the time period then sums them }
  6. { up.  You can change the values of R1..R4 to get different time periods. }
  7. { Buy when the KST rises above the trigger and sell when it falls below.  }
  8. { Use the three time periods to help you make your decision.  Also, strong}
  9. { buy signals are given when the KST falls below zero then rises above    }
  10. { zero.}
  11. {Below is a "beta" version......I feel it can still use further           }
  12. {documentation and improvements...it requires TAS 4.08 w/ Graph feature   }
  13. {Modified 20 Dec 92 to calculate each KST individualy also included a
  14. simple long term screen. Lew Hall 307-674-9585}
  15. #MAX_QUOTES 200
  16. {}
  17. { Define arrays to be used: }
  18. kst : ARRAY;
  19. kst1 : array;
  20. kst2 : array;
  21. kst3 : array;
  22. roc1 : array;
  23. roc2 : array;
  24. roc3 : array;
  25. roc4 : array;
  26. maroc1 : array;
  27. maroc2 : array;
  28. maroc3 : array;
  29. maroc4 : array;
  30. temp1 : array;
  31. temp2 : array;
  32. {Values for a short term KST:}
  33. r1 = 3;
  34. r2 = 4;
  35. r3 = 6;
  36. r4 = 10;
  37. gosub calckst1;
  38. kst1 = kst;
  39. {Values for a immed. KST:}
  40. r1= 10;
  41. r2= 13;
  42. r3= 15;
  43. r4 = 20;
  44. gosub calckst2;
  45. kst2 = kst;
  46. {Values for a long term KST:}
  47. r1 = 39;
  48. r2 = 52;
  49. r3 = 78;
  50. r4 = 104;
  51. gosub calckst3;
  52. kst3= kst;
  53. gosub screenit;
  54. {gosub graphit;}
  55. end;
  56. :calckst1
  57. if QUOTE_COUNT > 170 THEN
  58. BEGIN
  59.    {calculate ROC }
  60. roc1=ROC(c,r1,'%');
  61. roc2=ROC(C,r2,'%');
  62. roc3=ROC(C,r3,'%');
  63. roc4=ROC(C,r4,'%');
  64. {calculate MA on each array}
  65. maroc1=mov(roc1,3,'e');
  66. maroc2=mov(roc2,4,'e');
  67. maroc3=mov(roc3,6,'e');
  68. maroc4=mov(roc4,8,'e');
  69. {weight each array}
  70. mulby(maroc1,1); {redundant statement, used for clarity}
  71. mulby(maroc2,2);
  72. mulby(maroc3,3);
  73. mulby(maroc4,4);
  74. {sum up all the arrays}
  75. temp1 = ADD(maroc1,maroc2);
  76. temp2 = add(maroc3,maroc4);
  77. kst = add(temp1,temp2);
  78. end;
  79. return;
  80. :calckst2
  81. roc1=ROC(C,r1,'%');
  82. roc2=ROC(C,r2,'%');
  83. roc3=ROC(C,r3,'%');
  84. maroc1=mov(roc1,10,'e');
  85. maroc2=mov(roc2,13,'e');
  86. maroc3=mov(roc3,15,'e');
  87. maroc4=mov(roc4,20,'e');
  88. mulby(maroc1,1);
  89. mulby(maroc2,2);
  90. mulby(maroc3,3);
  91. mulby(maroc4,4);
  92. temp1 = ADD(maroc1,maroc2);
  93. temp2 = ADD(maroc3,maroc4);
  94. kst = ADD(temp1,temp2);
  95. end;
  96. return;
  97. :calckst3
  98. roc1=ROC(C,r1,'%');
  99. roc2=ROC(C,r2,'%');
  100. roc3=ROC(C,r3,'%');
  101. roc4=ROC(C,r4,'%');
  102. maroc1=mov(roc1,26,'e');
  103. maroc2=mov(roc2,26,'e');
  104. maroc3=mov(roc3,26,'e');
  105. maroc4=mov(roc4,39,'e');
  106. mulby(maroc1,1);
  107. mulby(maroc2,2);
  108. mulby(maroc3,3);
  109. mulby(maroc4,4);
  110. temp1 = ADD(maroc1,maroc2);
  111. temp2 = ADD(maroc3,maroc4);
  112. kst = ADD(temp1,temp2);
  113. end;
  114. return;
  115. :screenit
  116. if kst3 < 0 and
  117. kst3 >= mov(kst3,26,'e') and kst3[-2] < mov(kst3,26,'e')
  118. goto graphit;
  119. else
  120.    return;
  121. :graphit
  122. {Graph the three KSTs and display a 10 day MA "trigger"}
  123. {You may want to experiment with the trigger on the individual}
  124. {KSTs}
  125. OPENGRAPH(4);
  126. sizegraph(1,1,1,2);
  127. graph(kst1,'Short KST',mov(kst1,8,'e'),'8day MA');
  128. graph(kst2,'Immed KST',mov(kst2,10,'e'),'10day MA');
  129. graph(kst3,'Long  KST',mov(kst3,26,'e'),'26day MA');
  130. graph(1);
  131. closegraph();
  132. return;
  133.