StartOBV over to the right to leave room for labels
iOBVGraphOffset = 0 '34

li$ = ""

If rst = 1 Then Exit Sub

form6.Line (0, 595)-(600, 970), BRIGHTWHITE, BF

If HEIGHTPCT2 > 1 Then HEIGHTPCT2 = HEIGHTPCT2 * .01
If FROMTOP2 > 1 Then FROMTOP2 = .01 * FROMTOP2
f = maxv * HEIGHTPCT2 * 1.2
sp = 400: Rem:SP = FROMTOP2 * maxv * 1.1


For i = 1 To 270: obv(i) = 0: obvma(i) = 0: Next i

For i = 1 To rn: obv(i) = obv(i - 1)
If la(i) < la(i - 1) Then obv(i) = obv(i - 1) - VO(i): GoTo 6011
If la(i) > la(i - 1) Then obv(i) = obv(i - 1) + VO(i): GoTo 6011
6011 Rem
Next i
pmal = 21
For i = 1 To pmal: obvma(pmal) = obvma(pmal) + obv(i): Next i
For i = (pmal + 1) To rn: obvma(i) = obvma(i - 1) + obv(i) - obv(i - pmal): Next i
For i = pmal To rn: obvma(i) = obvma(i) / pmal: Next i

PMH = -999999: pml = 999999
For i = pmal To rn
If obv(i) > PMH Then PMH = obv(i)
If obv(i) < pml Then pml = obv(i)
Next i

psc = (PMH - pml)

xxx = (1 + iOBVGraphOffset) * 2 + over
yyy = (obv(1) - pml) * f / psc: yyy = f - yyy + sp
form6.PSet (xxx, yyy), BROWN

For i = 2 + iOBVGraphOffset To rn
xxx = i * 2 + over
yyy = (obv(i) - pml) * f / psc: yyy = f - yyy + sp
form6.Line -(xxx, yyy), BROWN
Next i

i = pmal + iOBVGraphOffset
xxx = i * 2 + over:
yyy = (obvma(i) - pml) * f / psc: yyy = f - yyy + sp
form6.PSet (xxx, yyy), lightred
For i = (pmal + 1 + iOBVGraphOffset) To rn
xxx = i * 2 + over
yyy = (obvma(i) - pml) * f / psc: yyy = f - yyy + sp
form6.PSet (xxx, yyy), lightred
Next i

bSavedTransparent = form6.FontTransparent
form6.FontTransparent = False
form6.CurrentX = 80: form6.CurrentY = 560: form6.Print "OBV"
form6.FontTransparent = bSavedTransparent

lastf = f: lastsp = sp
..........

ReDim va(275), ivxx(275), ipxxx(275), ipama(275), obvma(275)
Dim iMovingAverage As Integer, sMessage As String
Dim bSavedTransparent As Integer, iAccumGraphOffset As Integer
Static closepower(275), closepowerma(275)
'7-1-97 Rick changed AI and volume label wording and position

'Start IP21 over to the right to leave white area for labels
iAccumGraphOffset = 15

li$ = ""

f = maxv * HEIGHTPCT2 * .6

sp = 700
'
m44 = 21

For i = 1 To rn: obvma(i) = 0: mag(i) = z: Next i
For i = 1 To m44: obvma(m44) = obvma(m44) + obv(i): ivxx(m44) = ivxx(m44) + ip(i): Next i
For i = (m44 + 1) To rn: obvma(i) = obvma(i - 1) + obv(i) - obv(i - m44): Next i
For i = 21 To rn: obvma(i) = obvma(i) / 21: Next i
For i = 22 To rn
If obv(i) > obvma(i) Then mag(i) = mag(i) + 1
If obv(i) < obvma(i) Then mag(i) = mag(i) - 1
If obvma(i) > obvma(i - 1) Then mag(i) = mag(i) + 1
If obvma(i) < obvma(i - 1) Then mag(i) = mag(i) - 1


Next i


'
m44 = 21

For i = 1 To rn: va(i) = 0: ivxx(i) = 0: maip21(i) = 0: Next i
For i = 1 To m44: va(m44) = va(m44) + VO(i): ivxx(m44) = ivxx(m44) + ip(i): Next i
For i = (m44 + 1) To rn: va(i) = va(i - 1) + VO(i) - VO(i - m44):
ivxx(i) = ivxx(i - 1) + ip(i) - ip(i - m44): Next i

For i = m44 To rn
If va(i) > 0 Then ipxxx(i) = ivxx(i) / va(i)
Next i

ipll = -.5
iphh = .5

For i = m44 To rn
If ipxxx(i) > iphh Then iphh = ipxxx(i)
If ipxxx(i) < ipll Then ipll = ipxxx(i)
Next i

pml = ipll
PMH = iphh

If Int(pml) < PMH Then pml = -PMH Else PMH = Int(pml)
PMH = PMH * 1.1: pml = pml * 1.1

psc = PMH
For i = m44 + iAccumGraphOffset To rn
xxx = i * 2 + over
yyy = (ipxxx(i) - pml) * f / psc
yyy = f - yyy + sp
mpt = (PMH) * f / psc: mpt = f - mpt + sp
If ipxxx(i) > 0 Then form6.Line (xxx, yyy)-(xxx, mpt), lightBLUE
If ipxxx(i) < 0 Then form6.Line (xxx, yyy)-(xxx, mpt), lightred
Next i

i = m44 + iAccumGraphOffset
xxx = i * 2 + over
yyy = (ipxxx(i) - pml) * f / psc
yyy = f - yyy + sp
form6.PSet (xxx, yyy), black
For i = (m44 + 1 + iAccumGraphOffset) To rn
xxx = i * 2 + over: yyy = (ipxxx(i) - pml) * f / psc: yyy = f - yyy + sp
form6.Line -(xxx, yyy), black
Next i

For i = m44 + iAccumGraphOffset To rn Step 3
xxx = i * 2 + over: yyy = (.5 - pml) * f / psc: yyy = f - yyy + sp
form6.PSet (xxx, yyy), magenta
yyy = (.25 - pml) * f / psc: yyy = f - yyy + sp
form6.PSet (xxx, yyy), brightmagenta
yyy = (-.25 - pml) * f / psc: yyy = f - yyy + sp
form6.PSet (xxx, yyy), magenta
yyy = (-.5 - pml) * f / psc: yyy = f - yyy + sp
form6.PSet (xxx, yyy), brightmagenta
Next i
Rem:
For i = 1 To rn: maip21(i) = 0: Next i
For i = 22 To 42: maip21(42) = maip21(42) + ipxxx(i): Next i
For i = 43 To rn: maip21(i) = maip21(i - 1) + ipxxx(i) - ipxxx(i - 21): Next i
For i = 42 To rn: maip21(i) = maip21(i) / 21: Next i
For i = 42 To rn
xxx = i * 2 + over
yyy = (maip21(i) - pml) * f / psc
yyy = f - yyy + sp
If i = 42 Then form6.PSet (xxx, yyy), black: Else form6.Line -(xxx, yyy), black
Next i
Rem:
For i = 21 To rn
newipxxx(i) = ipxxx(i)
Next i

Rem:
sp = sp + 150
lastf = f
lastsp = sp

'Calculate IP21/200
kt = 0
For i = rn - 199 To rn
If ipxxx(i) > 0 Then kt = kt + 1
Next i

'Save the Form6 FontTransparent property
bSavedTransparent = form6.FontTransparent
form6.FontTransparent = False

form6.CurrentX = 1: form6.CurrentY = mpt - 90: form6.Print "Internal Strength"
form6.CurrentX = 1: form6.CurrentY = mpt - 60: form6.Print "Accum Index & TISI"
form6.CurrentX = 1: form6.CurrentY = mpt - 30: form6.Print "AI=" & Str$(kt) & "/200 "
form6.CurrentX = 1: form6.CurrentY = mpt - 0: form6.Print "Volume= " & VO(rn) & " "

'Calc the volume moving average
iMovingAverage = 50

SumVol = 0
For i = rn - iMovingAverage To rn - 1
SumVol = SumVol + VO(i)
Next i

AvgVol = SumVol / iMovingAverage
PctVol = VO(rn) / AvgVol

sMessage = "Vol/Vol" & Str$(iMovingAverage) & " DA= " & Format$(Str$(PctVol), "0.0")
form6.CurrentX = 1: form6.CurrentY = mpt + 30: form6.Print sMessage
kt = 0
For i = 2 To rn: If la(i) > la(i - 1) Then kt = kt + 1
Next i
kpct = kt / (rn - 1): kpct = Int(kpct * 1000 + .5) / 10
sMessage = "Pct.of Days Up=" & Str$(kpct) & "%"
form6.CurrentX = 1: form6.CurrentY = mpt + 60: form6.Print sMessage
'-----------------------------
grabrsqma
ktup = 0: ktdown = 0
For i = 2 To rn:
30 If la(i - 1) = z Then la(i - 1) = la(i):

pctpct = (la(i) - la(i - 1)) / la(i - 1)
If pctpct > .05 Then ktup = ktup + 1
If pctpct < -.05 Then ktdown = ktdown + 1
Next i
sMessage = "5%UpDays=" & Str$(ktup) & "vs 5%DnDays=" & Str$(ktdown) & " " & remar$
form6.CurrentX = 1: form6.CurrentY = mpt + 90: form6.Print sMessage
remk$ = ""
grabobvma
'-----------------
pmal = 21
For i = 1 To 270: ipama(i) = 0: Next i

For i = 1 To pmal: ipama(pmal) = ipama(pmal) + ipa(i): Next i
For i = (pmal + 1) To rn: ipama(i) = ipama(i - 1) + ipa(i) - ipa(i - pmal): Next i
For i = pmal To rn: ipama(i) = ipama(i) / pmal: Next i
i = rn
remark$ = ""
' If ipa(i) > ipama(i) Then remark$ = "IPA:Above its mvg.avg.Short-term bullish if confirmed by other rising ma's."
'If ipa(i) < ipama(i) Then remark$ = "IPA:Below its mvg.avg. Bearish short-term warning."
For i = 22 To rn
If ipa(i) > ipama(i) Then mag(i) = mag(i) + 1
If ipa(i) < ipama(i) Then mag(i) = mag(i) - 1
If ipama(i) > ipama(i - 1) Then mag(i) = mag(i) + 1
If ipama(i) < ipama(i - 1) Then mag(i) = mag(i) - 1


Next i


'form6.CurrentX = 1: form6.CurrentY = 1000: form6.Print remark$
remark$ = ""
'------------------
For i = 1 To rn:
gz = la(i) - OPNG(i)
closepower(i) = closepower(i - 1) + gz:
Next i
pmal = 21
For i = 1 To 270: closepowerma(i) = z: Next i

For i = 1 To pmal: closepowerma(pmal) = closepowerma(pmal) + closepower(i): Next i
For i = (pmal + 1) To rn: closepowerma(i) = closepowerma(i - 1) + closepower(i) - closepower(i - pmal): Next i
For i = pmal To rn: closepowerma(i) = closepowerma(i) / pmal: Next i
i = rn
If closepower(i) > closepowerma(i) And closepowerma(i) > closepowerma(i - 1) Then remark$ = "Closing Power:Above rising mvg.avg.Short-term bullish. Generally OK to buy at opening."
If closepower(i) < closepowerma(i) And closepowerma(i) < closepowerma(i - 1) Then remark$ = "Closing Power:Below falling mvg.avg. Short-term bearish warning. Generally unsafe to buy at opening."


form6.CurrentX = 1: form6.CurrentY = 1000: form6.Print remark$
For i = 22 To rn
If closepower(i) > closepowerma(i) Then mag(i) = mag(i) + 1
If closepower(i) < closepowerma(i) Then mag(i) = mag(i) - 1
If closepowerma(i) > closepowerma(i - 1) Then mag(i) = mag(i) + 1
If closepowerma(i) < closepowerma(i - 1) Then mag(i) = mag(i) - 1


Next i


'-----------------

form6.CurrentX = 1: form6.CurrentY = mpt + 120: form6.Print remk$

'form6.CurrentX = 1: form6.CurrentY = mpt + 120: form6.Print sMessage




form6.FontTransparent = bSavedTransparent