History File Output Automation

Posted By mh Tuesday, November 27, 2012
Add to Favorites0
Author Message
mh
 Posted Tuesday, November 27, 2012
Supreme Being

Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)

Group: Forum Members
Last Active: Monday, March 18, 2013
Posts: 7, Visits: 26
Dear Moderator,

you have been so kind in the past that I apply to you for a new request.
I would like to have a strategy coded, very simple (not for me): on every new candle, a txt ascii file is saved containing the complete candles history for current instrument.
So, the ourput file will be in the form (for 1H time frame):

DateTime,Open,High,Low,Close
20120102 10:00:00,1423.25,1426.00,1422.00,1423.00
20120102 11:00:00,1423.00,1423.00,1420.50,1422.00
20120102 12:00:00,1422.75,1423.00,1420.00,1420.50
etc.


In other words, I'd like to automate the "Save Chart Data to File" command availble in app menu.
Maybe a strategy in not necessary to accomplish the task, but I cannot see another solution.

Thank you indeed for your help,
mh


from mh
black
 Posted Tuesday, November 27, 2012
Supreme Being

Supreme Being - (96,265 reputation)Supreme Being - (96,265 reputation)Supreme Being - (96,265 reputation)Supreme Being - (96,265 reputation)Supreme Being - (96,265 reputation)Supreme Being - (96,265 reputation)Supreme Being - (96,265 reputation)Supreme Being - (96,265 reputation)Supreme Being - (96,265 reputation)

Group: Forum Members
Last Active: Sunday, July 13, 2014
Posts: 520, Visits: 1,004
mh (11/27/2012)
Dear Moderator,

you have been so kind in the past that I apply to you for a new request.
I would like to have a strategy coded, very simple (not for me): on every new candle, a txt ascii file is saved containing the complete candles history for current instrument.
So, the ourput file will be in the form (for 1H time frame):

DateTime,Open,High,Low,Close
20120102 10:00:00,1423.25,1426.00,1422.00,1423.00
20120102 11:00:00,1423.00,1423.00,1420.50,1422.00
20120102 12:00:00,1422.75,1423.00,1420.00,1420.50

etc.


In other words, I'd like to automate the "Save Chart Data to File" command available in app menu.
Maybe a strategy in not necessary to accomplish the task, but I cannot see another solution.

Thank you indeed for your help,
mh


I am NOT the Moderator, but, below is a script for a very simple Historical Data gathering Strategy. The results, after running the Strategy as a test in the Tester, will be found in the Log. You will need to copy and paste from the Log into a text file. Hope this helps.

Smile

-------------------- Strategy script below.

const
StrategyName = 'Historical Data Simple';

var //declaration of the variables
History: TCandleHistory;
Account: TAccount;

procedure OnCreate;
begin
AddCandleHistorySetting(@History, 'History', '', CI_1_Hour, 10); //setting up the chart history
History.OnNewCandleEvent := @OnNewCandle; //indicating the procedure to run when a new candle opens
Settings.AddAccount(@Account, 'Account', ''); //the account number

end;

///////////////////////////////////////////////////////////////////////////

procedure OnNewCandle;
begin
Point := History.Instrument.PointSize;

log(DateTimeToStr(Now)+ ',' +FloatToStr(History.Last(1).Open)+ ','
+FloatToStr(History.Last(1).High)+ ',' +FloatToStr(History.Last(1).Low)+ ','
+FloatToStr(History.Last(1).Close));

end;
mh
 Posted Tuesday, November 27, 2012
Supreme Being

Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)Supreme Being - (1,647 reputation)

Group: Forum Members
Last Active: Monday, March 18, 2013
Posts: 7, Visits: 26
Thank you. It's not exactly what I'm searching for, but help to understand a possible solution. Thanks again.


from mh
Tuesday, November 27, 2012 by mh

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top