Penso proprio di si...

provo a postarlo così:

uses classes
uses SysUtils
dim f as textfile
dim callss as tsecurity
dim mainunderlying as tunderlying
dim bidsc as tprice = [0,0,0,0,0]
dim asksc as tprice = [0,0,0,0,0]
dim bidsp as tprice = [0,0,0,0,0]
dim asksp as tprice = [0,0,0,0,0]
dim correzioneatm,i as double
dim ATMf as Tstringlist
dim ATM,Filename,strtosave,ATMtit as string
dim calls as toption = [0,0,0,0,0]
dim puts as toption = [0,0,0,0,0]
dim underisin,anno, mese, giorno,nextexpma ,strike, Tuonome, smese
dim varbidtickc as double = [0,0,0,0,0]
dim varasktickc as double = [0,0,0,0,0]
dim varbidtickp as double = [0,0,0,0,0]
dim varasktickp as double = [0,0,0,0,0]


mainUnderlying = CurrentStrategy.GetMainUnderlying()
underisin = mainunderlying.isin


DecodeDate(Now(), anno, mese, giorno)

'scrivi il tuo nome
tuonome = "Apo"


'scegli il mese di scadenza
smese = 2



if mese<10 then
nextexpma = "0"+cstr(smese) + "-" + cstr(anno)
else
nextexpma = cstr(smese) + "-" + cstr(anno)
end if

'crea il nome del file giornaliero

'prende l'atm da un file txt oppure si può impostare scrivendo ATM = 3000
'ATMf = new TStringList()
'ATMf.LoadFromFile("C:\Users\user\Dropbox\ATM.TXT" )
'ATM=Cint(ATMf.text)
'ATMf.free

ATM = 2035

Filename = "c:\users\user\dropbox\" + cstr(giorno) + cstr(mese) + cstr(anno) + cstr(smese) + "askbidticks" + tuonome + ".txt"

correzioneatm = (ATM - int(mainunderlying.Last/5)*5)/5


'assegnazione di una variabile array ad ogni opzione
for i = 0 to 4
strike = cstr(cstr(ATM) + (i-2)*5)

calls[i] = CurrentStrategy.getbyName("C @ "+strike+" "+nextexpma)
puts[i] = CurrentStrategy.GetByName("P @ "+strike+" "+nextexpma)

next



for i=-2 to 2 step 1
bidsc[i+2]=calls[i+2].bidObject
asksc[i+2]=calls[i+2].askobject
varbidtickc[i+2]=bidsc[i+2].tickcounter
varasktickc[i+2]=asksc[i+2].tickcounter

bidsp[i+2]=puts[i+2].bidObject
asksp[i+2]=puts[i+2].askobject
varbidtickp[i+2]=bidsp[i+2].tickcounter
varasktickp[i+2]=asksp[i+2].tickcounter

next


strtosave= cstr(mainUnderlying.Last)&" "&
cstr(calls[0].ask)&" "&cstr(varasktickc[0])&" "&cstr(calls[0].bid)&" "&cstr(varbidtickc[0])&" "&
cstr(puts[0].ask)&" "&cstr(varasktickp[0])&" "&cstr(puts[0].bid)&" "&cstr(varbidtickp[0])&" "&
cstr(calls[1].ask)&" "&cstr(varasktickc[1])&" "&cstr(calls[1].bid)&" "&cstr(varbidtickc[1])&" "&
cstr(puts[1].ask)&" "&cstr(varasktickp[1])&" "&cstr(puts[1].bid)&" "&cstr(varbidtickp[1])&" "&
cstr(calls[2].ask)&" "&cstr(varasktickc[2])&" "&cstr(calls[2].bid)&" "&cstr(varbidtickc[2])&" "&
cstr(puts[2].ask)&" "&cstr(varasktickp[2])&" "&cstr(puts[2].bid)&" "&cstr(varbidtickp[2])&" "&
cstr(calls[3].ask)&" "&cstr(varasktickc[3])&" "&cstr(calls[3].bid)&" "&cstr(varbidtickc[3])&" "&
cstr(puts[3].ask)&" "&cstr(varasktickp[3])&" "&cstr(puts[3].bid)&" "&cstr(varbidtickp[3])&" "&
cstr(calls[4].ask)&" "&cstr(varasktickc[4])&" "&cstr(calls[4].bid)&" "&cstr(varbidtickc[4])&" "&
cstr(puts[4].ask)&" "&cstr(varasktickp[4])&" "&cstr(puts[4].bid)&" "&cstr(varbidtickp[4])



if SysUtils.FileExists(FileName)then

AssignFile(f, Filename)
Append(f)
Writeln(f, strtosave)
CloseFile(f)



else

strtosave = mainUnderlying.name & " " & DateToStr(date()) &" "& "ATM:"&cstr(ATM)
AssignFile(f, Filename)
Rewrite(f)
Writeln(f, strtosave)
CloseFile(f)

'inserimento nella strategia delle 5 + 5 opzioni più atm
for i=-5 to 5 step 1
CurrentStrategy.AddParametricOption(underisin,CALL ,correzioneatm-i,5)
CurrentStrategy.AddParametricOption(underisin,PUT, correzioneatm-i,5)


next




SetPersistentVar(ATMtit,ATM)

end if