Hi,
Newbie here.
As an exercise in learning Zorro, I'm trying to code a youtube strategy (yes, I know it won't make me any money :-) ).
The strategy:
- entry after first hour of forex session (EUR session starts at 0800h UTC)
- if 2nd hour of session goes above high of first hour, enter long
- if 2nd hour of session goes below low of first hour, enter short
- exit after 4 hours
- TP=50 PIPs
Here is my code:
function run()
{
BarPeriod = 60;
LifeTime = 4;
int LondonOpen = timeOffset(UTC,0,9,0);
vars PriceHigh = series(priceHigh(1));
vars PriceLow = series(priceLow(1));
vars Price = series(price());
TakeProfit = 50;
if((LondonOpen==0) && (Asset="GBP/USD"))
{
if(Price<PriceLow)
enterShort();
else if(Price>PriceHigh)
enterLong();
}
}
Am I even close?
Problems (that I've noticed so far):
- trades don't enter at high or low of bar
- trades don't go in proper direction
Any help/suggestions would be appreciated.
Thanks,
Neil