Posted By

staccato on 12/18/12


Tagged

candle


Versions (?)

candle stick


 / Published in: TCL
 

URL: candle

candle

  1. set nrows [m rows]
  2.  
  3. for {set i 0} {$i<$nrows} {incr i} {
  4. set row [m get row $i]
  5. set date [lindex $row 0]
  6. set x [lindex $row 1]
  7. set open [lindex $row 2]
  8. set high [lindex $row 3]
  9. set low [lindex $row 4]
  10. set close [lindex $row 5]
  11. set volumn [lindex $row 6]
  12. .c.right.report.tree insert {} end -values [list $date $x $open $high $low $close $volumn]
  13. }
  14. set res {}
  15.  
  16. set x {}
  17. set open {}
  18. set close {}
  19. set high {}
  20. set low {}
  21.  
  22. for {set i 0} {$i<100} {incr i} {
  23. set row [m get row $i]
  24. lappend open [lindex $row 2]
  25. lappend high [lindex $row 3]
  26. lappend low [lindex $row 4]
  27. lappend close [lindex $row 5]
  28. lappend x $open
  29.  
  30. }
  31.  
  32. #set sorted [lsort -real $res]
  33. #set max [lindex $sorted end]
  34. #set min [lindex $sorted 0]
  35.  
  36. #puts $max
  37. #puts $min
  38.  
  39. #set yaxis {}
  40. #lappend yaxis $min
  41. #lappend yaxis $max
  42. #lappend yaxis 5.0
  43.  
  44. #set s [::Plotchart::createXYPlot .c.left.graph_canvas.canvas {0.0 100.0 10.0} $yaxis]
  45.  
  46. #foreach {x y} {0.0 32.0 10.0 50.0 25.0 60.0 78.0 11.0 } {
  47. #$s plot series1 $x $y
  48. #}
  49.  
  50. #$s title "Data series"
  51.  
  52. #for {set i 0} {$i<100} {incr i} {
  53. #$s plot series1 $i [lindex $res $i]
  54. #}
  55.  
  56. set data {}
  57. for {set i 0} {$i<10} {incr i} {
  58. lappend data $i
  59. }
  60.  
  61. set s [::Plotchart::createBoxplot2 .c.left.graph_canvas.canvas {357 359 1} $data ]
  62.  
  63. for {set i 0} {$i<10} {incr i} {
  64. set x_i [lindex $x $i]
  65. set open_i [lindex $open $i]
  66. set close_i [lindex $close $i]
  67. set low_i [lindex $low $i]
  68. set high_i [lindex $high $i]
  69. set candle {}
  70. lappend candle [expr { double($open_i)}]
  71. lappend candle [expr {double($open_i)}]
  72. lappend candle [expr {double($close_i)}]
  73. lappend candle [expr {double($low_i)}]
  74. lappend candle [expr {double($high_i)}]
  75.  
  76. $s plot [lindex $data $i] $candle
  77. }

Report this snippet  

You need to login to post a comment.