Forex Factory (
-   Platform Tech (
-   -   EA compare yesterdays 8pm price against todays 11am price (

RichyF Apr 5, 2010 5:27am | Post# 1

EA compare yesterdays 8pm price against todays 11am price
Hi guys
Happy easter to you all
Any skilled EA programmers out there that can help with a small query?

In my EA I am trying to find out what the price was yesterday at 20:00. Then compare against the price this morning (Between 10am-12:00 midday).

Inserted Code
datetime yestdatetime = StrToTime(StringConcatenate(Year(),".",Month(),".", (Day() -1), ", 20:00"));
Whilst my code seems to be working (Although a little rough, new to programming) it wont go back further than 17th March. I suspect this is a problem with iBarShift possibly?

Also I am struggling to find out what the high was for the morning period (Between 10am and 12midday).

Any ideas?


sangmane Apr 5, 2010 8:12am | Post# 2

PHP Code:
datetime yestdatetime StrToTime(TimeToStr(Time[0],TIME_DATE)+" 20:00")-24*60*60;

RichyF Apr 5, 2010 1:40pm | Post# 3

Brill, Thanks Samgmane, dont fully understand it yet but I think I am getting there.

It seems to be working but still with the same problem, my backtest only goes back 11 days. As soon as I try to backtest anything but the last 11 days I get zero figures.

I am backtesting the Dow Jones Index (Hence "WS30" as my symbol). I have checked and the data is there. However I am on a demo account.

I have set offset as a double, could it be that I need a variable that can do larger numbers?


Ronald Raygun Apr 5, 2010 2:02pm | Post# 4

PHP Code:

double LastPrice 
iClose(NULL0iBarShift(NULL0StrToTime("20:00") - 24*3600true)); 

© Forex Factory