Lgon
Joined 22.04.2013
High and Low of a time frame 14 May 2013, 22:11
Hello,
I need to get the high and low of a specific time frame (e.g. 8am EST and 10 am EST - defined by input) to build a breakout range robot.
Can someone please help me with the code?
Thanks
Balena 16 May 2013, 05:32
Hello, I need to get the high and low of a specific time frame (e.g. 8am EST and 10 am EST - defined by input) to build a breakout range robot. Can someone please help me with the code? Thanks
here's what I use... you can set the hours you want it to collect high & lows...
private DateTime startTime; private DateTime activeTime; private DateTime stopTime;
private double myEquityLow;
private double myEquityHigh;
private double myEquitySnapShot = 0;;
startTime = Server.Time.Date;
activeTime = startTime.AddHours(5);
stopTime = startTime.AddHours(7);
myEquityLow = myEquityLow;
myEquityHigh = myEquityHigh;
myEquitySnapShot = myEquitySnapShot;
then use conditionals...
if(Server.Time > activeTime && Server.Time < stopTime && equitySnapShot =0)
{
myEquityLow = Account.Equity;
myEquityHigh = Account.Equity
equitySnapShot = 1 }
if(Server.Time > activeTime && Server.Time < stopTime && Account.Equity < myEquityLow)
{ myEquityLow = Account.Equity; }
if(Server.Time > activeTime && Server.Time < stopTime && Account.Equity < myEquityHigh)
{ myEquityHigh = Account.Equity; }
Lgon 24 May 2013, 18:24
Thank You!
Balena
16 May 2013, 05:32
RE:
here's what I use... you can set the hours you want it to collect high & lows...
private DateTime startTime;
private DateTime activeTime;
private DateTime stopTime;
private double myEquityLow;
private double myEquityHigh;
private double myEquitySnapShot = 0;;
startTime = Server.Time.Date;
activeTime = startTime.AddHours(5);
stopTime = startTime.AddHours(7);
myEquityLow = myEquityLow;
myEquityHigh = myEquityHigh;
myEquitySnapShot = myEquitySnapShot;
then use conditionals...
if(Server.Time > activeTime && Server.Time < stopTime && equitySnapShot =0)
{
myEquityLow = Account.Equity;
myEquityHigh = Account.Equity
equitySnapShot = 1
}
if(Server.Time > activeTime && Server.Time < stopTime && Account.Equity < myEquityLow)
{
myEquityLow = Account.Equity;
}
if(Server.Time > activeTime && Server.Time < stopTime && Account.Equity < myEquityHigh)
{
myEquityHigh = Account.Equity;
}
@Balena