High and Low of a time frame

Created at 14 May 2013, 22:11
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
LG

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


@Lgon
Replies

Balena
16 May 2013, 05:32

RE:
Lgon said:

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;
        } 


@Balena

Lgon
24 May 2013, 18:24

Thank You!


@Lgon