Realtime data NOW,ODIN,TradeTiger,Google,Yahoo > AmiBroker, Fcharts, Qtstalker

Status
Not open for further replies.

mrkanitkar

Well-Known Member
Changes done, it gives compiling error on line of Next C, error is
"Next without For"
Here is ref code.
---------------
Sub MakeCSV()

Dim fs As Object, a As Object, y As Object, C As Integer, i As Integer, r As Integer, S As String, t As Variant, CellValue As String
'Create a file object for writing
Set fs = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
MkDir ("C:\RT") 'This will create a folder RT in C Drive.
FileName = "C:\RT\MyCSVMS.txt" 'This file is used to write quotes
Set a = fs.CreateTextFile(FileName, True) 'Here we create the file MyCSV.csv

If NSENOW = "Yes" Then
a.writeline "TICKER,PER,DATE,TIME,OPEN,HIGH,LOW,CLOSE,VOLUME,OPEN INTEREST"
MyBook.Sheets("Now").Select 'Selects sheet containing quotations

For r = 7 To Range("A65536").End(xlUp).Row
S = ""
For C = 1 To 5
While Not IsEmpty(Cells(r, C))
If C = 1 Then
CellValue = Cells(r, C).Value & Left(Cells(r, 6).Value, 1) & Cells(r, 7).Value & ",I," & Format$(Date, "yyyymmdd") ' ' (Insert first letter of Option Type, Strike Price, comma and I and Date after ticker name)
ElseIf C = 3 Then 'Insert Last Traded Price 4 times for O,H,L,C
CellValue = Cells(r, C).Value & "," & Cells(r, C).Value & "," & Cells(r, C).Value & "," & Cells(r, C).Value
ElseIf C = 4 Then
CellValue = Cells(r, C).Value - Vol(r, 1)
Vol(r, 1) = Cells(r, C).Value

' Debug.Print Cells(r, 1).Value & " - " & CellValue & " - " & Vol(r, 1)
Else
CellValue = Cells(r, C).Value '
End If

' CellValue = Cells(r, C).Value '
S = S & CellValue & "," 'Add contents of current cell to string 's' and a comma


Next C

Wend
a.writeline S 'write line
Next r
End If

-----------
 
Last edited:

josh1

Well-Known Member
Change it to this -
--------------------------------------------------------
Sub MakeCSV()

Dim fs As Object, a As Object, y As Object, C As Integer, i As Integer, r As Integer, S As String, t As Variant, CellValue As String
'Create a file object for writing
Set fs = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
MkDir ("C:\RT") 'This will create a folder RT in C Drive.
FileName = "C:\RT\MyCSVMS.txt" 'This file is used to write quotes
Set a = fs.CreateTextFile(FileName, True) 'Here we create the file MyCSV.csv

If NSENOW = "Yes" Then
a.writeline "TICKER,PER,DATE,TIME,OPEN,HIGH,LOW,CLOSE,VOLUME,O PEN INTEREST"
MyBook.Sheets("Now").Select 'Selects sheet containing quotations
For r = 7 To Range("A65536").End(xlUp).Row
S = ""
While Not IsEmpty(Cells(r, C))
If C = 1 Then
CellValue = Cells(r, C).Value & Left(Cells(r, 6).Value, 1) & Cells(r, 7).Value & ",I," & Format$(Date, "yyyymmdd") ' ' (Insert first letter of Option Type, Strike Price, comma and I and Date after ticker name)

ElseIf C = 3 Then 'Insert Last Traded Price 4 times for O,H,L,C
CellValue = Cells(r, C).Value & "," & Cells(r, C).Value & "," & Cells(r, C).Value & "," & Cells(r, C).Value

ElseIf C = 4 Then
CellValue = Cells(r, C).Value - Vol(r, 1)
Vol(r, 1) = Cells(r, C).Value

' Debug.Print Cells(r, 1).Value & " - " & CellValue & " - " & Vol(r, 1)

ElseIf C > 5 Then

Else
CellValue = Cells(r, C).Value '

End If

S = S & CellValue & "," 'Add contents of current cell to string 's' and a comma

Wend
a.writeline S 'write line
Next r
 

mrkanitkar

Well-Known Member
Excel hangs after new changes. In file nothing getting written except header.
Here is code
-------------

Sub MakeCSV()

Dim fs As Object, a As Object, y As Object, C As Integer, i As Integer, r As Integer, S As String, t As Variant, CellValue As String
'Create a file object for writing
Set fs = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
MkDir ("C:\RT") 'This will create a folder RT in C Drive.
FileName = "C:\RT\MyCSVMS.txt" 'This file is used to write quotes
Set a = fs.CreateTextFile(FileName, True) 'Here we create the file MyCSV.csv

If NSENOW = "Yes" Then
a.writeline "TICKER,PER,DATE,TIME,OPEN,HIGH,LOW,CLOSE,VOLU ME,O PEN INTEREST"
MyBook.Sheets("Now").Select 'Selects sheet containing quotations
For r = 7 To Range("A65536").End(xlUp).Row
S = ""
While Not IsEmpty(Cells(r, C))
If C = 1 Then
CellValue = Cells(r, C).Value & Left(Cells(r, 6).Value, 1) & Cells(r, 7).Value & ",I," & Format$(Date, "yyyymmdd") ' ' (Insert first letter of Option Type, Strike Price, comma and I and Date after ticker name)

ElseIf C = 3 Then 'Insert Last Traded Price 4 times for O,H,L,C
CellValue = Cells(r, C).Value & "," & Cells(r, C).Value & "," & Cells(r, C).Value & "," & Cells(r, C).Value

ElseIf C = 4 Then
CellValue = Cells(r, C).Value - Vol(r, 1)
Vol(r, 1) = Cells(r, C).Value

' Debug.Print Cells(r, 1).Value & " - " & CellValue & " - " & Vol(r, 1)

ElseIf C > 5 Then

Else
CellValue = Cells(r, C).Value '

End If

S = S & CellValue & "," 'Add contents of current cell to string 's' and a comma

Wend
a.writeline S 'write line
Next r
End If


If Yahoo = "Yes" Then
For r = 7 To Range("K65536").End(xlUp).Row
S = ""
C = 10
While Not IsEmpty(Cells(r, C))
If C = 12 Then
CellValue = Cells(r, 16).Value + Secs
Else

CellValue = Cells(r, C).Value '
End If
S = S & CellValue & "," 'Add contents of current cell to string 's' and a comma
C = C + 1
Wend

If Cells(r, 16).Value >= 0.64583 Then
ElseIf Cells(r, 16).Value <= 0.38542 Then
Else
'Debug.Print "time is correct"
a.writeline S 'write line
End If

Next r
End If
End Sub
-------------------
I can send you excel file if you need quickly. let me know email. Here is file for download http://www.4shared.com/file/m1O_ZthL/RT31.html?
my contacts are mrkanitkar at gmail dot com.
 
Last edited:

mrkanitkar

Well-Known Member
Here is output
---------
TICKER,PER,DATE,TIME,OPEN,HIGH,LOW,CLOSE,VOLUME,O/I
NIFTYP5100,I,20120717,12:01:18,15.35,15.35,15.35,15.35,2050,6687050,6687050,6687050,
NIFTYP5000,I,20120717,12:01:17,5.1,5.1,5.1,5.1,3850,8574200,8574200,8574200,
NIFTYP5300,I,20120717,12:01:18,97.3,97.3,97.3,97.3,500,3549950,3549950,3549950,
INFY0,I,20120717,12:01:14,2183.5,2183.5,2183.5,2183.5,0,4822625,4822625,4822625,
NIFTYC5300,I,20120717,12:01:17,22.75,22.75,22.75,22.75,700,8996300,8996300,8996300,
NIFTYP5200,I,20120717,12:01:17,42.3,42.3,42.3,42.3,1000,5685100,5685100,5685100,
NIFTYC5100,I,20120717,12:01:11,137.45,137.45,137.45,137.45,0,1462350,1462350,1462350,
NIFTYC5200,I,20120717,12:01:18,65.95,65.95,65.95,65.95,2200,4473050,4473050,4473050,
NIFTY0,I,20120717,12:01:17,5224,5224,5224,5224,400,24913900,24913900,24913900,
BANKNIFTY0,I,20120717,12:01:16,10624,10624,10624,10624,100,2760975,2760975,2760975,
EURINR0,I,20120717,11:59:43,67.805,67.805,67.805,67.805,0,30034,30034,30034,
NIFTYC5400,I,20120717,12:01:16,5.3,5.3,5.3,5.3,600,9273800,9273800,9273800,
TATAMOTORS 0,I,20120717,12:01:17,229.85,229.85,229.85,229.85,2197,0,0,0,
USDINR0,I,20120717,12:01:16,55.225,55.225,55.225,55.225,3564,1439465,1439465,1439465,
--------
O/I is written 3 times.
 

josh1

Well-Known Member
MR

Take this final. Note the empty column after Open Interest. I cannot think of better solution.

http://www.4shared.com/file/ilvs3FlM/RTMS.html

This is output
TICKER,PER,DATE,TIME,OPEN,HIGH,LOW,CLOSE,VOLU ME,O PEN INTEREST
NIFTYP5100,I,20120717,13:00:10,16.75,16.75,16.75,16.75,0,6781650,
NIFTYP5000,I,20120717,12:21:29,5.8,5.8,5.8,5.8,0,8571750,
NIFTYP5300,I,20120717,13:00:10,103.8,103.8,103.8,103.8,0,3470500,
INFY0,I,20120717,12:21:20,2180.15,2180.15,2180.15,2180.15,0,4820000,
NIFTYC5300,I,20120717,13:00:09,20.25,20.25,20.25,20.25,0,9246050,
NIFTYP5200,I,20120717,13:00:10,46.05,46.05,46.05,46.05,0,5672750,
NIFTYC5100,I,20120717,12:21:28,130.15,130.15,130.15,130.15,0,1451400,
NIFTYC5200,I,20120717,13:00:10,60.3,60.3,60.3,60.3,0,4625800,
NIFTY0,I,20120717,13:00:10,5214.9,5214.9,5214.9,5214.9,0,25100750,
BANKNIFTY0,I,20120717,12:21:28,10582.25,10582.25,10582.25,10582.25,0,2756975,
NIFTYC5400,I,20120717,13:00:08,4.55,4.55,4.55,4.55,0,9576150,
TATAMOTORS 0,I,20120717,12:21:28,229.05,229.05,229.05,229.05,0,0,
0,0,0,0,0,
0,0,0,0,0,
 
Last edited:

josh1

Well-Known Member
MR,

Don't use Meta Refresh. do this instead.

Using with Metastock:
1. Install Metastock Pro (version 8 or above required).
2. Run the Metastock in Offline Mode.
3. Open Any Chart you want from the folder C:\RTDATA\ms
4. Now your realtime chart in Metastock will updated automatically tick by tick.
 
Data is updated in MS format, no issues.
:thumb:
I think backfill will be issue as MS does not merge 1 min data with tick data.
I will run this for 1-2 days and let you know.
Thanks once again.
Friends !
Please answer patiently because I have not gone through the entire thread and also for the all Metastock guys .
1.Will Nest work with this utility ?
2.Do we have to download the files in the first post and enter the arbitrage details in Excel ?
3.How to use this RTMS .xlx file ?
4. Does Metastock flicker ? (with other utilities this is an irritating feature and if we try to insert any indicator it would crash ) .
5.Does Metastock miss any ticks or quotes ?
Thanks in advance .
 
Status
Not open for further replies.

Similar threads