This is what I ended up with:
Code: Select all
on mouseUp
global tClose2
put url "http://table.finance.yahoo.com/table.csv?s=AAPL" into field "MainData"
replace comma with tab in field "MainData"
set the itemdelimiter to tab
put empty into Temp
repeat with i= 2 to 1000
put item 7 of line i of field "MainData" into tClose
put 1000-i, 200-round(tClose) & return before tAdjustedPoints
put round(item 7 of line i of field "MainData",1) &"," after Temp
end repeat
put empty into field "Scale"
put max (Temp) - min (Temp) into theRange
put theRange/10 into theInterval
Put 0 into Inc
repeat with L = 45 down to 1 step -5
add 1 to Inc
put round ((theInterval*Inc),0) + round(min (Temp),0) into line L of field "Scale"
end repeat
put round(max (Temp),0) into line 1 of field "Scale"
put round(min (Temp),0) into line 50 of field "Scale"
set the points of graphic "Adjusted close" to tAdjustedPoints
set the width of graphic "Adjusted close" to the width of graphic "Frame"
set the height of graphic "Adjusted close" to the height of graphic "Frame" *.99
set the bottom of graphic "Adjusted close" to the bottom of graphic "Frame"
set the left of graphic "Adjusted close" to the left of graphic "Frame"
put "" into field "Dates"
repeat with i= 1002 down to 2 Step -100
put item 1 of line i of field "MainData" & " " after field "Dates"
end repeat
end mouseUp
Where:
Main the data field is now named "MainData"
Create a rectangle (named "Frame", W-1000 , H-500, Border-2)
Field "Scale" (text height 10, 12 pt, bold, H-516, W-60) is placed next to graphic "Frame" and field "Dates" (10 pt, bold, H-26, W-1068) is placed below graphic "Frame" to create labels.
Then place a transparent field (Text height 50, horizontal & vertical grids checked, Tab stops = 100) over graphic "Frame" to create a grid.
The data acquired actually goes back to 1984- but this routine only utilizes the last 1000 lines of data which includes 2005 to present. Variations could easily be made to include earlier years.