PDA

View Full Version : Multiple instances of script



abdulaziz
08-18-2015, 12:45 PM
Sir,
I have wrote a script to complete a specific task using VTL.
My script stores some values in a text file to make calculation and decision making. The script is working fine. But i am facing a difficulty that, it is not possible to attach this script more than 1 symbol as each instance of script requires different values to be stored.


for Example :
Configuration file name : myscriptconfig.txt
Symbol Name : GOLD
Values for Calculation and analysis : value-1, value-2, value-3


How can i add this script with Symbol "SILVER" ?
If i add this with 2nd symbol "SILVER", the values saved in "myscriptconfig.txt" for GOLD will be overwritten.


Kindly help me.


Regards
Abdul Azeez

Rawan-HS
08-19-2015, 12:09 PM
Dear abdulaziz

you can write each information for different symbol in a separated text file according to chart symbol
try the bellow code and tell me if you need anythings .




Public Sub main()
''''TODO: Script program start method
Dim fileName
Dim fileMode


fileMode = FILE_APPEND
fileName = ChartSymbol(0) & ".txt"
file = StringReplace(fileName , "/", " ")

OpenFile file, CInt(fileMode)
FileWrite "ChartSymbol " & ChartSymbol(0)
CloseFile




End Sub