Free data from NSENOW to AmiBroker via Excel

Status
Not open for further replies.
First you have to stop AmiBroker from opening.
1. Open Visual Basic code from Developer Tab. Go to StartTimer subroutine in Module1.
Comment out or remove this line- InitialiseAB 'Start AmiBroker

2. Go to Stop_Timer Subroutine . Comment out or remove this line- AB.SaveDatabase

3. Go to Subroutine Timer. Comment out or remove this line- CallAmiBroker 'Calls AmiBroker for importing file

After that- 4. Go to Subroutine MakeCSV() and find this line-
Set a = fs.CreateTextFile("C:\RT\MyCSV.csv", True) 'Here we create the file MyCSV.csv
The parameter "True" means file can be overwritten. Change it to "False" and see what happens. Microsoft does not say whether file will be appended if "False" is given. If it starts appending then you are set.
See this link for further help- http://msdn.microsoft.com/en-us/library/aa265018(v=vs.60).aspx

If it does not append, you will have to find other ways of coding. Remove this part of code from Subroutine MakeCSV()
fs As Object, a As Object,
'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.
Set a = fs.CreateTextFile(C:\RT\MyCSV.csv, True) 'Here we create the file MyCSV.csv

Put Public fs As Object, Public a As Object, in global declarations.
Paste rest of the above code in Subroutine Start_Timer and check.

Note-I am not a professional programmer. You will have to do some R&D.
Thanks a lot sir :)
Will try these steps..hopefully it should work.
 
Hello josh1 sir, i tried your utility today and its working very well. Charts are updating smoothly in Ami. Thanks for the great and simple utility.
But i am facing a problem in backfilling part. Every symbol in Ami is coming with a "0" after the symbol name, for example "NIFTY12MAYFUT" is displayed as "NIFTY12MAYFUT0". Because of this "0" when i try to backfill a new symbol adds with name "NIFTY12MAYFUT" and so i have to merge these two symbols for backfill. So how i remove this 0 from symbol names?
 

josh1

Well-Known Member
Hello josh1 sir, i tried your utility today and its working very well. Charts are updating smoothly in Ami. Thanks for the great and simple utility.
But i am facing a problem in backfilling part. Every symbol in Ami is coming with a "0" after the symbol name, for example "NIFTY12MAYFUT" is displayed as "NIFTY12MAYFUT0". Because of this "0" when i try to backfill a new symbol adds with name "NIFTY12MAYFUT" and so i have to merge these two symbols for backfill. So how i remove this 0 from symbol names?
Open the NSENOW2.format file in notepad.
Replace this line - $FORMAT Date_MDY, Ticker, Time, Close, Volume, Appendticker, Appendticker

with this - $FORMAT Date_MDY, Ticker, Time, Close, Volume, Skip, Skip
 
Open the NSENOW2.format file in notepad.
Replace this line - $FORMAT Date_MDY, Ticker, Time, Close, Volume, Appendticker, Appendticker

with this - $FORMAT Date_MDY, Ticker, Time, Close, Volume, Skip, Skip
Thank you sir for the reply. sir one more issue i am facing, after backfill the data on the chart is shown only between 9:16 am to 12:59 pm.
In my Ami time setting is 9:01 to 15:30. Should i change in time setting so that i can see the chart for whole trading session?

Sir it seems there is a.m., p.m. problem. I think Amibroker takes 24 hour time format. Hence in backfill CSV file instead of 1:00 pm if there would be 13:00 hrs, then probably it would be displayed in charts.
 
Last edited:

josh1

Well-Known Member
Thank you sir for the reply. sir one more issue i am facing, after backfill the data on the chart is shown only between 9:16 am to 12:59 pm.
In my Ami time setting is 9:01 to 15:30. Should i change in time setting so that i can see the chart for whole trading session?

Sir it seems there is a.m., p.m. problem. I think Amibroker takes 24 hour time format. Hence in backfill CSV file instead of 1:00 pm if there would be 13:00 hrs, then probably it would be displayed in charts.
NOW gives time in 24 Hour format. If you are getting it in 12 Hour, use "Find and Replace" feature of Excel to replace 1:00 pm with 13:00. First replace all am or pm with blanks. Thereafter, replace 1: with 13:, 2: with 14: and 3: wit 15: That should work. It will not take more than half minute. You can record this and create macro which can be reused.
 
Thank you sir for the reply. sir one more issue i am facing, after backfill the data on the chart is shown only between 9:16 am to 12:59 pm.
In my Ami time setting is 9:01 to 15:30. Should i change in time setting so that i can see the chart for whole trading session?

Sir it seems there is a.m., p.m. problem. I think Amibroker takes 24 hour time format. Hence in backfill CSV file instead of 1:00 pm if there would be 13:00 hrs, then probably it would be displayed in charts.
the problem is neither in ambibroker or NOW setting, it is in your computer operating system setting , which you have to change to what is in nest data table setting.
Is you operating system is windows 7 then go to control panel, clock language region , region language, change the date, time number format, inthe window, format tab, format -- choose, English (India), short date drop down chose dd-MM-yyyy, long date dd-MMMM-yyyy, short time HH:mm, long time HH:mm:ss

What you should be careful is time should be capital HH and not small hh, small hh is 12 hour time format and capital HH is 24 hour time format.

This should hopefully solve your problem
 
Status
Not open for further replies.

Similar threads