here is the code i have made:
Code: Select all
proc pub:pivot {nick host hand chan arg} {
if {[llength $arg]==0} {
putserv "PRIVMSG $channel :\0035 Ein Symbol musst Du schon eingeben :-)\003"
} else {
set stock [string toupper [lindex $arg 0]]
set tok [http::geturl http://quotes.barchart.com/quote.asp?sym=$stock&code=BHTDR]
set data [http::data $tok]
set high [lindex [split $data \n] 127]
set low [lindex [split $data \n] 128]
set close [lindex [split $data \n] 129]
set pivot [expr {([string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $high 7]] + [string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $low 7]] + [string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $close 7]]) / 3}]
set r1 [expr {(2 * $pivot) - [string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $low 7]]}]
set r2 [expr {$pivot + ([string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $high 7]] - [string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $low 7]])}]
set s1 [expr {(2 * $pivot) - [string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $high 7]]}]
set s2 [expr {$pivot - ([string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $high 7]] - [string map {{color="#000000">} {} {</FONT></TD>} {}} [lindex $low 7]])}]
putserv "PRIVMSG $chan :\0030,14 Pivots for $stock -> \0038,14[format %.2f $r2] \0035,14(R2) \0038,14[format %.2f $r1] \0035,14(R1) \0038,14[format %.2f $pivot] \0035,14(Pivot) \0038,14[format %.2f $s1] \0035,14(S1) \0038,14[format %.2f $s2] \0035,14(S2) \003"
}
}
Until now I look for the line nr. in the source to fetch the high, low and the close stockquote from yesterday (see the picture)
BUT
this won't work for the most of the time because the line nr. in the source code change VERY OFFEN

How could I fetch the needed stockquotes (high, low and the close from yesterday) in a better way (so that it doesnt care what line nr the needed stockquotes have)?
THANKS
jagg
I need these stockquotes

P.S.: The formula for calculate the pivot points can be see e.g. here
http://www.technical-investor.de/conten ... 2&hl=pivot