Day High / Low

Posted By biz.sonia Tuesday, March 09, 2010
Add to Favorites0
Author Message
biz.sonia
 Posted Tuesday, March 09, 2010
Supreme Being

Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)

Group: Forum Members
Last Active: Wednesday, July 28, 2010
Posts: 8, Visits: 21
Hi Members,

I am new to actfx - i would like to know how to write a simple program in .act to find today's (Present Day) HIGH / LOW and Last Trade Price. Could you please help me in this.

Thanks

Sonia

black
 Posted Wednesday, March 10, 2010
Supreme Being

Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)

Group: Forum Members
Last Active: Sunday, July 13, 2014
Posts: 520, Visits: 1,004
biz.sonia (3/10/2010)
Hi Members,

I am new to actfx - i would like to know how to write a simple program in .actto find today's (Present Day) HIGH / LOW and Last Trade Price. Could you please help me in this.

Thanks

Sonia


// This script will show the date and time of day that your broker uses as their end of day,
// followed by their High, Low and Close for the date listed... in the Log. Once you open the
// Strategy, you need to set the number of days that you want to check. Set it under the "Test" tab.

//======================================================

const
StrategyName = 'HLC Log';

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

procedure OnCreate;
begin

AddCandleHistorySetting(@History, 'History', 'EURUSD', CI_1_Day, 5); //setting up the chart history
History.OnNewCandleEvent := @OnNewCandle; //indicating the procedure to run when a new candle opens
AddAccountSetting(@Account, 'Account', ''); //the account number

end;

procedure OnStart;
begin


end; // Ends the OnNewCandle procedure.


procedure OnNewCandle;
begin

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

end; // Ends the OnNewCandle procedure.


 HLC_Log.act (92 views, 1.10 KB)
biz.sonia
 Posted Wednesday, March 10, 2010
Supreme Being

Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)

Group: Forum Members
Last Active: Wednesday, July 28, 2010
Posts: 8, Visits: 21
Thanks for the Code.

but there is a problem in this - if i run this code it gives me the days high / low and close on a new candle but then stops there because the next candle is at end of the day as it is D1.

What i am looking at is a 1 Min candle which can give me todays high / close / low every min but not according to the last candle. because now if i apply the same code to the 1 min candle it give me the low / high and close of the last candle which is not necessarily the same as low / high of the day.

Please let me know if there is any code for this where i can get the high and low and the last price of the day every minute.

Thanks in advance

scriptor
 Posted Thursday, March 11, 2010
Supreme Being

Supreme Being - (11,003 reputation)Supreme Being - (11,003 reputation)Supreme Being - (11,003 reputation)Supreme Being - (11,003 reputation)Supreme Being - (11,003 reputation)Supreme Being - (11,003 reputation)Supreme Being - (11,003 reputation)Supreme Being - (11,003 reputation)Supreme Being - (11,003 reputation)

Group: Forum Members
Last Active: Monday, October 04, 2010
Posts: 67, Visits: 186
Perhaps this indicator may help you: http://www.actfx.com/Download50067.aspx




Sincerely,

Benjamin Hoover
black
 Posted Thursday, March 11, 2010
Supreme Being

Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)Supreme Being - (100,767 reputation)

Group: Forum Members
Last Active: Sunday, July 13, 2014
Posts: 520, Visits: 1,004
biz.sonia (3/11/2010)
Thanks for the Code.

but there is a problem in this - if i run this code it gives me the days high / low and close on a new candle but then stops there because the next candle is at end of the day as it is D1.

What i am looking at is a 1 Min candle which can give me todays high / close / low every min but not according to the last candle. because now if i apply the same code to the 1 min candle it give me the low / high and close of the last candle which is not necessarily the same as low / high of the day.

Please let me know if there is any code for this where i can get the high and low and the last price of the day every minute.

Thanks in advance


This Strategy will give you the Highest High and the Lowest Low for the time period you set under the Test" tab, in the "Start history test from (days ago)" box.

-------------------------------------------------------------------

// Under the "Test" tab you can set the Strategy for a certain number of days. When you set the number
////// of days, take that number and multiply it by 1440 and then add 1440 more. Enter the result under
////// the "Log" tab, in the "Console Size (lines)" box. Then start the Strategy.

//======================================================

const
StrategyName = 'HLC 1-Minute Log';

var //declaration of the variables
History, History1: TCandleHistory;
Account: TAccount;
HighHigh, LowLow: Double;

procedure OnCreate;
begin

AddCandleHistorySetting(@History, 'History', 'EURUSD', CI_1_Day, 5); //setting up the chart history
History.OnNewCandleEvent := @OnNewCandle; //indicating the procedure to run when a new candle opens

AddCandleHistorySetting(@History1, 'History 1', 'EURUSD', CI_1_Minute, 5); //setting up the chart history
History1.OnNewCandleEvent := @OnNewCandle; //indicating the procedure to run when a new candle opens

AddAccountSetting(@Account, 'Account', ''); //the account number

end;

procedure OnStart;
begin

HighHigh:=History.Last(1).Close;
LowLow:=History.Last(1).Close;

end; // Ends the OnStart procedure.


procedure OnNewCandle;
begin

if (History1.Last(1).High > HighHigh) then
begin
HighHigh:=History1.Last(1).High;
end;

if (History1.Last(1).Low < LowLow) then
begin
LowLow:=History1.Last(1).Low;
end;

log('Time: ' +DateTimeToStr(Now)+ ' Today High so far: ' +FloatToStr(HighHigh)+ ' Today Low so far: ' +FloatToStr(LowLow)+ ' 1-Minute Close: ' +FloatToStr(History1.Last(1).Close));

end; // Ends the OnNewCandle procedure. Smile
 HLC_1M_Log.act (96 views, 1.64 KB)
Thursday, March 11, 2010 by black
biz.sonia
 Posted Thursday, March 18, 2010
Supreme Being

Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)Supreme Being - (2,000 reputation)

Group: Forum Members
Last Active: Wednesday, July 28, 2010
Posts: 8, Visits: 21
Thanks for the help - This code worked.

I just have 2 more doubts.

When i Place an order via the program - can I capture the Ticket Number of the trade for further refernce

And then can i run a for Loop to see if the Ticket Number Exists and modify my SL or TSL.

Please help me in this.

Thanks in Advance


Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top