alte tabl file1 add colu buybreak f(16,8)
alte tabl file1 add colu sellbreak f(16,8)
sele contract dist from file1 into curs contracts
scan
m.tempcontract=contract
sele date, contract, abshigh, abslow, recno() as rec from file1 wher contract=m.tempcontract orde by rec desc into curs breakout readwrit
alte tabl breakout add colu buybreak f(6,0)
alte tabl breakout add colu sellbreak f(6,0)
sele breakout
scan
m.temprec=rec
m.temprecno1=recno()
m.abshigh=abshigh
m.abslow=abslow
loca rest for abshigh>m.abshigh
m.temprecno2=recno()-m.temprecno1
sele breakout
repl all buybreak with m.temprecno2 for rec=m.temprec
go m.temprecno1
loca rest for abslow
|