I'm trying to code a simple trading system:


Quote:
Find the high low range of first hours trading:

Buy on the breakout of the lowest low or the highest high of that first hour.

Profit target is the range between the high and low of first hour.

Stop set in opposite of trade direction equal to first hours trading range.

Exit at end of day, if no stops or limits get hit.

Don’t trade if range is higher than 40 points:


Quote:

function run()
{

BarPeriod = 5;

LookBack = 30;

vars Price = series(price());

if(hour(UTC) >= 16.30) // Exit trade at end of the day if stop or target have not been met.
exitLong();


Stop = 40*PIP; // - Change this to the amount of the range in first hours trading.

TakeProfit = 40*PIP: // - Change this to the amount of the range in first hours trading.


Dont trade if range is > 40 PIP; // Set dont trade if the rage in higher than 40*PIP;


if (*Price > HH(30) && NumOpenLong <1 && hour(UTC) >9 && hour(UTC) < 16.30) // Buy on breakout outside of the first hours range.
enterLong();

else if (*Price > LL(30) && NumOpenShort <1 && hour(UTC) > 9 && hour(UTC) < 16.30) // Sell on breakout outside of the first hours range.

enterShort();


}






But am finding it difficult to get right code for finding out the high low range of first hours trading as the system uses this for stop and profit targets and my coding skills are not that great.

So looking to find the range of the first hours trading of hour(UTC) 8 to 9..

How so you do this?

???

Profit target is set from the the range (PIPS between the high and low of first hour trading)

TakeProfit = ???


Stop to be set in opposite of trade direction equal to first hours trading range..

Stop = ???


Also don’t trade if first hour range is higher than 40 points:

???


Would appreciate any help on the above as i'm stuck.

Thanks.








Last edited by Geek; 11/06/13 00:09.