home *** CD-ROM | disk | FTP | other *** search
- -- background: 19480 from stack: in.2
- -- bmap block id: 20340
- -- flags: 4000
- -- background id: 0
- -- name: Advance-Decline Chart
- ----- HyperTalk script -----
- on openBackground
- push recent card
- end openBackground
-
- function frameheight
- return 235
- end frameheight
-
- function framewidth
- return 400
- end framewidth
-
- function framebottom
- return 275
- end framebottom
-
- function frameleft
- return 1
- end frameleft
-
- on NewCard
- global minBaseValue
- global lineCount,itemCount,highItem,lowItem
- put minBaseValue into field "Base Value"
- put 0 into lineCount
- put 0 into itemCount
- put 0 into highItem
- put 0 into lowItem
- repeat with i=1 to 3
- arrowDirection i
- end repeat
- end NewCard
-
- on putRange highItem,lowItem
- global lineCount
- get item highItem of line 1 of field "data"
- subtract item lowItem of line 1 of field "data" from it
- add field "Base Value" to it
- put it into highValue
- put it into lowValue
- put it into currentValue
- repeat with i=2 to lineCount
- get item highItem of line i of field "data"
- subtract item lowItem of line i of field "data" from it
- add it to currentValue
- if currentValue>highValue then
- put currentValue into highValue
- else
- if currentValue<lowValue then
- put currentValue into lowValue
- end if
- end if
- end repeat
- put highValue into field "High"
- put lowValue into field "Low"
- put currentValue into field "Close"
- end putRange
-
- on OpenCard
- global lineCount,itemCount,highItem,lowItem
- repeat with i=1 to 3
- arrowDirection i
- end repeat
- put the number of lines of field "Data" into lineCount
- put the number of items in line 1 of field "Data" into itemCount
- put 1 into highItem
- put 2 into lowItem
- if itemCount>1 then
- put 2 into highItem
- put 3 into lowItem
- end if
- if highItem>1 then
- put item 1 of last line of field "data" into field "Date of Last Update"
- else
- put empty into field "Date of Last Update"
- end if
- putRange highItem,lowItem
- SetforUpdate
- end OpenCard
-
- on AddDate startDate
- put startDate into newDate
- convert newDate to seconds
- put 7*24*3600 into aWeek -- seconds in a week
- put the number of lines of field "data" into lineCount
- repeat with i=1 to lineCount
- put newDate into currentdate
- convert currentdate to dateItems
- put character 3 to 4 of item 1 of currentDate into year
- put item 2 of currentDate into month
- if month<10 then
- put "0"&month into month
- end if
- put item 3 of currentDate into day
- if day<10 then
- put "0"&day into day
- end if
- get line i of field "data"
- put year&month&day&","&it into line i of field "data"
- add aWeek to newDate
- end repeat
- end AddDate
-
- on MovingAverage avg,avgNr,span
- global lineCount
- global upArrow,downArrow
- put "Average "&avgNr into avgField
- put "bkgnd button ""e&"direction "&avgNr"e into arrowButton
- put 0 into iconNr
- if lineCount>=span then
- put rounders(Avg,span) into field avgField
- if lineCount>=span+2 then
- put Avg into Avga
- put lineCount into endCount
- put lineCount-span into startCount
- subtract line endCount of field "Plot Values" from Avga
- add line startCount of field "Plot Values" to Avga
- put Avga into Avgb
- subtract 1 from endCount
- subtract 1 from startCount
- subtract line endCount of field "Plot Values" from Avgb
- add line startCount of field "Plot Values" to Avgb
- if Avg > Avga then
- if Avga>Avgb then
- put upArrow into iconNr
- end if
- else
- if Avg < Avga then
- if Avga < Avgb then
- put downArrow into iconNr
- end if
- end if
- end if
- end if -- lineCount>=span+2
- else
- put empty into field avgField
- end if -- lineCount>=span
- put iconNr into line avgNr of field "Directions"
- if iconNr=0 then
- hide arrowButton
- else
- set icon of arrowButton to iconNr
- show arrowButton
- end if
- end MovingAverage
-
-
-
-
- -- part 2 (field)
- -- low flags: 00
- -- high flags: 0002
- -- rect: left=0 top=20 right=38 bottom=100
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 2
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Stock Symbol
-
-
- -- part 3 (field)
- -- low flags: 00
- -- high flags: 0002
- -- rect: left=99 top=20 right=38 bottom=413
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 2
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Stock Name
-
-
- -- part 4 (field)
- -- low flags: 00
- -- high flags: 0002
- -- rect: left=412 top=20 right=38 bottom=512
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 2
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Date of last update
-
-
- -- part 5 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=412 top=37 right=55 bottom=512
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: High
-
-
- -- part 6 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=412 top=54 right=72 bottom=512
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Low
-
-
- -- part 7 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=412 top=71 right=89 bottom=512
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Close
-
-
- -- part 8 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=411 top=121 right=139 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Average 1
-
-
- -- part 9 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=411 top=138 right=156 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Average 2
-
-
- -- part 10 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=411 top=155 right=173 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Average 3
-
-
- -- part 11 (field)
- -- low flags: 00
- -- high flags: 4007
- -- rect: left=88 top=278 right=341 bottom=423
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Data
- ----- HyperTalk script -----
- function checkItems
- global itemCount,lineCount
- put the number of items of line 1 of field "data" into itemCount
- repeat with i=2 to lineCount
- if itemcount<>the number of items of line i of field "data" then
- put i-2 into scrolledLines
- if scrolledLines>0 then
- multiply scrolledLines by the textheight of field "Data"
- set the scroll of field "Data" to scrolledLines
- end if
- answer "Inconsistent line"
- return false
- exit checkItems
- end if
- end repeat
- return true
- end checkItems
-
- on updateBaseValue highItem,lowItem
- global maxDataPoints,minBaseValue,maxBaseValue,lineCount
- repeat while number of lines of field "data" > maxDataPoints
- get item highItem of line 1 of field "data"
- subtract item lowItem of line 1 of field "data" from it
- add it to field "Base Value"
- if field "Base Value" < 0 then
- put minBaseValue in field "Base Value"
- else
- if field "Base Value" > maxBaseValue then
- put maxBaseValue/2 in field "Base Value"
- end if
- end if
- delete line 1 of field "data"
- end repeat
- put the number of lines of field "data" into lineCount
- end updateBaseValue
-
- on CloseField
- global itemCount,lineCount
- put the number of lines of field "data" into lineCount
- if field "data" is empty then
- Clearfields
- else
- if field "data" is return then
- Clearfields
- put empty into field "data"
- else
- if checkItems() then
- updateBaseValue
- get number of items of last line of field "data"
- if it>2 then
- put item 1 of last line of field "data" into field "Date of Last Update"
- else
- put empty into field "Date of Last Update"
- end if
- else
- Clearfields
- end if
- end if
- end if
- end CloseField
-
-
- -- part 14 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=67 top=317 right=336 bottom=87
- -- title width / last selected line: 0
- -- icon id / first selected line: 1014 / 1014
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Prev
- ----- HyperTalk script -----
- on mouseUp
- global firstChart
- visual effect wipe left
- if the number of this card > firstChart then
- go to previous card
- else
- go card "Title Card"
- end if
- end mouseUp
-
-
- -- part 15 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=5 top=319 right=338 bottom=25
- -- title width / last selected line: 0
- -- icon id / first selected line: 21700 / 21700
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Home
- ----- HyperTalk script -----
- on mouseUp
- visual effect iris close
- go home
- end mouseUp
-
-
-
-
- -- part 16 (button)
- -- low flags: 00
- -- high flags: A001
- -- rect: left=448 top=278 right=325 bottom=485
- -- title width / last selected line: 0
- -- icon id / first selected line: 12074 / 12074
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Plot
- ----- HyperTalk script -----
- on mouseUp
- global lineCount,span1,span2,span3
- put the userLevel into saveLevel
- if the userLevel < 3 then set userLevel to 3 -- "Painting"
- clearScreen
- set the cursor to 4 -- Set watch cursor
- reset paint
- choose line tool
- set lineSize to 1
- set pattern to 14
- set filled to true
- put frameleft()+3 into horiz
- put the number of lines in field "Data" into lineCount
- put the number of items in line 1 of field "Data" into itemCount
- put 1 into highItem
- put 2 into lowItem
- if itemCount>2 then
- put 2 into highItem
- put 3 into lowItem
- end if
- if highItem>1 then
- put item 1 of last line of field "data" into field "Date of Last Update"
- else
- put empty into field "Date of Last Update"
- end if
- putRange highItem,lowItem
- put field "High" into maxValue
- put 6 into horizStep
- put round(horizStep * 3/4) into width
- put field "Base Value" into currentValue
- repeat with i = 1 to lineCount
- add item highItem of line i of field "data" to currentValue
- subtract item lowItem of line i of field "data" from currentValue
- put round(frameheight() * currentValue / maxValue) into height
- drag from horiz,framebottom()-height to horiz,framebottom()-height+width
- put round(height-width/2) into height
- drag from horiz,framebottom()-height to horiz+2,framebottom()-height
- put currentvalue into line i of field "Plot Values"
- add horizStep to horiz
- end repeat
- put 0 into Sum1
- if lineCount>span1 then
- repeat with i=lineCount-span1+1 to lineCount
- add line i of field "Plot Values" to Sum1
- end repeat
- end if
- if lineCount>span2 then
- put Sum1 into Sum2
- repeat with i=lineCount-span2+1 to lineCount-span1
- add line i of field "Plot Values" to Sum2
- end repeat
- else
- put 0 into Sum2
- end if
- if lineCount>span3 then
- put Sum2 into Sum3
- repeat with i=lineCount-span3+1 to lineCount-span2
- add line i of field "Plot Values" to Sum3
- end repeat
- else
- put 0 into Sum3
- end if
- movingAverage sum1,1,span1
- movingAverage sum2,2,span2
- movingAverage sum3,3,span3
- reset paint
- put empty into field "Plot Values" -- need values only temporarily
- choose browse tool
- set userLevel to saveLevel
- end mouseUp
-
-
-
-
- -- part 17 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=423 top=319 right=338 bottom=443
- -- title width / last selected line: 0
- -- icon id / first selected line: 1013 / 1013
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Next
- ----- HyperTalk script -----
- on mouseUp
- global firstChart
- visual effect wipe right
- if the number of this card < the number of cards then
- go to next card
- else
- go card "Title Card"
- end if
- end mouseUp
-
-
- -- part 18 (field)
- -- low flags: 80
- -- high flags: 0000
- -- rect: left=344 top=295 right=313 bottom=474
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Base Value
-
-
- -- part 19 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=497 top=121 right=137 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 16692 / 16692
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: direction 1
- ----- HyperTalk script -----
- on mouseUp
- get icon of bkgnd button "direction 1"
- if it≠16692 then
- put 16692 into it
- else
- put 3584 into it
- end if
- set icon of bkgnd button "direction 1" to it
- end mouseUp
-
-
-
- -- part 20 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=497 top=138 right=154 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 16692 / 16692
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: direction 2
- ----- HyperTalk script -----
- on mouseUp
- get icon of bkgnd button "direction 2"
- if it≠16692 then
- put 16692 into it
- else
- put 3584 into it
- end if
- set icon of bkgnd button "direction 2" to it
- end mouseUp
-
-
-
- -- part 21 (button)
- -- low flags: 80
- -- high flags: 0000
- -- rect: left=497 top=155 right=171 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 3584 / 3584
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: direction 3
- ----- HyperTalk script -----
- on mouseUp
- get icon of bkgnd button "direction 3"
- if it≠16692 then
- put 16692 into it
- else
- put 3584 into it
- end if
- set icon of bkgnd button "direction 3" to it
- end mouseUp
-
-
-
- -- part 22 (field)
- -- low flags: 81
- -- high flags: 0000
- -- rect: left=156 top=120 right=139 bottom=304
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Directions
-
-
- -- part 23 (field)
- -- low flags: 80
- -- high flags: 0000
- -- rect: left=156 top=120 right=205 bottom=356
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Plot Values
-
-
- -- part 24 (button)
- -- low flags: 00
- -- high flags: 2000
- -- rect: left=492 top=319 right=338 bottom=510
- -- title width / last selected line: 0
- -- icon id / first selected line: 1012 / 1012
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: To Title Card
- ----- HyperTalk script -----
- on mouseUp
- go to card "Title Card"
- end mouseUp
-
-
-
- -- part 25 (button)
- -- low flags: 00
- -- high flags: 8000
- -- rect: left=28 top=278 right=322 bottom=60
- -- title width / last selected line: 65535
- -- icon id / first selected line: -6047 / 59489
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Import
- ----- HyperTalk script -----
- on mouseUp
- ask "File Name" with "Interchange:"
- put it into fileName
- open file fileName
- read from file fileName for 32000
- put it into field "data"
- close file fileName
- send closeField to field "data"
- end mouseUp
-
-