Forex
Google

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum FAQ Members List Calendar Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

 
 
LinkBack Thread Tools
 
Old 03-04-2006, 08:57 AM
ammar ammar is offline
Junior Member
 
Join Date: Dec 2005
Posts: 18
ammar is on a distinguished road
lowest & highest

Hi
How could I return the lowest low or the highest high, starting from the beginning of the opened order ?

Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-04-2006, 01:38 PM
Mohammed's Avatar
Mohammed Mohammed is offline
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Red face

Quote:
Originally Posted by ammar
Hi
How could I return the lowest low or the highest high, starting from the beginning of the opened order ?

Thank you.
Hi ammar,

This is a real puzzle.
We can get the order open time by the function: OrderOpenTime.
But how can we convert this time to bar??

well, if we know the timeframe of the chart we can consider every bar is walk in the history for this time.
For example: if the TF is 30M then every bar is current time - 30 minutes.
So, if we know the opened time of the order and the timeframe then we can know what the bar number of the opened order.

Let me to work around this solution.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-04-2006, 05:48 PM
ammar ammar is offline
Junior Member
 
Join Date: Dec 2005
Posts: 18
ammar is on a distinguished road
Thank you Mohammed for your helping,
You gave me an idea .
We can use this code :

double Lo=Low [Lowest (NULL,0,MODE_LOW,( CurTime( )-OrderOpenTime( ))/(60*Period( )),0)];
double Hi=High [Highest (NULL,0,MODE_HIGH,(CurTime( )-OrderOpenTime( ))/(60*Period( )),0)];

What do you think ?
Bye.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-04-2006, 10:38 PM
Mohammed's Avatar
Mohammed Mohammed is offline
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Thumbs up

Quote:
Originally Posted by ammar
Thank you Mohammed for your helping,
You gave me an idea .
We can use this code :

double Lo=Low [Lowest (NULL,0,MODE_LOW,( CurTime( )-OrderOpenTime( ))/(60*Period( )),0)];
double Hi=High [Highest (NULL,0,MODE_HIGH,(CurTime( )-OrderOpenTime( ))/(60*Period( )),0)];

What do you think ?
Bye.
ammar,

It seems logical!

But I'm not sure CurTime( )-OrderOpenTime( ) will return an integer.
The second thing, if the above code is right it must be like that:

double Lo=Low [Lowest (NULL,0,MODE_LOW,The_Period_You_Want,( CurTime( )-OrderOpenTime( ))/(60*Period( )))];
double Hi=High [Highest (NULL,0,MODE_HIGH,The_Period_You_Want,(CurTime( )-OrderOpenTime( ))/(60*Period( )))];

Well, we have to test the above code!
__________________
There is a fine line between freedom of expression and hate literature.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-04-2006, 11:07 PM
Mohammed's Avatar
Mohammed Mohammed is offline
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Talking

ammber,
Please try this code!
Attached Files
File Type: mq4 EA_Demo.mq4 (1.9 KB, 61 views)
__________________
There is a fine line between freedom of expression and hate literature.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-05-2006, 04:14 PM
ammar ammar is offline
Junior Member
 
Join Date: Dec 2005
Posts: 18
ammar is on a distinguished road
Thank you Mohammed For your help.
But I'm sorry, the code didnt work for me, because I don't want to define a certain period which I want the highest or lowest value for it.
The code I wrote before worked for me, but I don't know maybe I'm wrong.
Thank you again , you are very kind.
Ammar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-05-2006, 09:15 PM
Mohammed's Avatar
Mohammed Mohammed is offline
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Talking

Quote:
Originally Posted by ammar
Thank you Mohammed For your help.
But I'm sorry, the code didnt work for me, because I don't want to define a certain period which I want the highest or lowest value for it.
The code I wrote before worked for me, but I don't know maybe I'm wrong.
Thank you again , you are very kind.
Ammar
Ammar,

I'm happy it worked .
__________________
There is a fine line between freedom of expression and hate literature.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-06-2006, 12:22 AM
Michel Michel is offline
Senior Member
 
Join Date: Feb 2006
Posts: 502
Michel is on a distinguished road
Ammar, you could also use iBarShift() function :

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)

Search for bar by open time. The function returns bar shift with the open time specified. If the bar having the specified open time is absent the function will return, depending on the exact parameter, -1 or the nearest bar shift.

Parameters:

symbol - Symbol the data of which should be used to calculate indicator. NULL means the current symbol.
timeframe - Time frame. It can be any of Time frame enumeration values.
time - value to find (bar's open time).
exact - Return mode when bar not found. false - iBarShift returns nearest. true - iBarShift returns -1.

Sample:

datetime some_time=D'2004.03.21 12:00';
int shift=iBarShift("EUROUSD",PERIOD_M1,some_time);
Print("shift of bar with open time ",TimeToStr(some_time)," is ",shift);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-06-2006, 09:13 AM
ammar ammar is offline
Junior Member
 
Join Date: Dec 2005
Posts: 18
ammar is on a distinguished road
Thank you Michel,
But how could I use this function to return the highest and lowest from the opening of the orders.
Good luck.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Highest high for an indicator derekc Indicators - Metatrader 4 17 05-24-2008 11:18 AM
Broker with indexes & lowest spread pete7 General Discussion 9 09-23-2006 10:18 PM
Low[Lowest(...)]; fxid10t Metatrader 4 3 01-21-2006 10:08 PM


All times are GMT. The time now is 05:23 PM.