# Thread: History price

1. ## History price

hy
I,ve question
is it possible to use history price?
I want use close friday price at monday second bar at 1h TF and i don't know what function do
can anybody help ?

2. On the basis that the Friday close is also the weekly close, its value would be:

double FridayClose=iClose(Symbol(),10080,1);

You could also use the daily close to do the same thing, but I wouldn't recommend it as some brokers open their books on a Sunday evening and have a short price bar so this would alter the shift of the Friday close on the D1 timeframe.

You would then need to implement some logic to perform your other function (you didn't say what this is) on Monday morning, perhaps along these lines:

if(DayOfWeek()==1 //0=Sun, 1=Mon, 2=Tue, etc
&& Hour()==2) //This will vary according to your broker's GMT offset
{//Do whatever you want here
};

3. Originally Posted by jezzer1961
On the basis that the Friday close is also the weekly close, its value would be:

double FridayClose=iClose(Symbol(),10080,1);

You could also use the daily close to do the same thing, but I wouldn't recommend it as some brokers open their books on a Sunday evening and have a short price bar so this would alter the shift of the Friday close on the D1 timeframe.

You would then need to implement some logic to perform your other function (you didn't say what this is) on Monday morning, perhaps along these lines:

if(DayOfWeek()==1 //0=Sun, 1=Mon, 2=Tue, etc
&& Hour()==2) //This will vary according to your broker's GMT offset
{//Do whatever you want here
};
thanks a lot Jezz
tell me please - value 10800 is it time from start week to the end in min ? or other ?

i want place two pending orders after first bar opening week in opposite if gap mondayopenprice-fridayclose > than xvalue

4. 10080 is the timeframe enumeration value representing the weekly charts in MT4. You could substitute the value with PERIOD_W1 if you wished as this would do exactly the same thing.

You would need to do something like this with your conditions:

if(DayOfWeek()==1 //0=Sun, 1=Mon, 2=Tue, etc
&& Hour()==2 //This will vary according to your broker's GMT offset
&& Minute()==0
&& Bid-FridayClose > "your x value")
{//Send pending order
};

5. Originally Posted by jezzer1961
10080 is the timeframe enumeration value representing the weekly charts in MT4. You could substitute the value with PERIOD_W1 if you wished as this would do exactly the same thing.

You would need to do something like this with your conditions:

if(DayOfWeek()==1 //0=Sun, 1=Mon, 2=Tue, etc
&& Hour()==2 //This will vary according to your broker's GMT offset
&& Minute()==0
&& Bid-FridayClose > "your x value")
{//Send pending order
};
yes. thanks
but Bid is actuall price
how to code open week price ?

it's idea from Bernstein book, open trade after 1h first bar week in opposite way to gap(if it is), but i think that more safe is place pending two direction in distance from open first bar and close price first weekend bar.

6. The open price is simply a variation of the code which gave the Friday close.

double SundayOpen=iOpen(Symbol(),10080,0);

But this isn't what you originally asked for. You wanted the code to give the price at a certain time 1 or 2 hours after the market opened. The piece of code that I provided earlier gave the bid at a specific time on a certain day (ie 2:00am on Monday). So if you just set the time to perform the gap check to the same time as the H1 bar that you want opens, the bid at that time will be the same value as the open.

You would just need to modify this for your broker as all brokers open at a different time on Sunday and have different GMT offsets.

7. Originally Posted by jezzer1961
The open price is simply a variation of the code which gave the Friday close.

double SundayOpen=iOpen(Symbol(),10080,0);

But this isn't what you originally asked for. You wanted the code to give the price at a certain time 1 or 2 hours after the market opened. The piece of code that I provided earlier gave the bid at a specific time on a certain day (ie 2:00am on Monday). So if you just set the time to perform the gap check to the same time as the H1 bar that you want opens, the bid at that time will be the same value as the open.

You would just need to modify this for your broker as all brokers open at a different time on Sunday and have different GMT offsets.

yes. of course you right
if that specific time is open week time price bid is open week price

#### Tags for this Thread

100, broker, brokers, mt4, time

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•