Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-18-2006, 01:12 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Smile EA for Previous BAR Close, High, Low, Open

Hi Guys,

How can I make an Ea which lok for the previous BAR open, close, high and low price and then depending on the conditions take long position or short...

Thanks

Babar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 05-18-2006, 04:05 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Can someone please give me an idea...???

Thanks
Babar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 05-18-2006, 04:17 PM
Member
 
Join Date: Dec 2005
Posts: 60
yousky is on a distinguished road
Hi,

I'm not strong in MT4 coding but I think you have to use this:

Open[Bars-1] => Previous open bar value.
Close[Bars-1] => Previous close bar value.
High[Bars-1] => Previous high bar value.
Low[Bars-1] => Previous low bar value.

bye bye
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 05-18-2006, 04:59 PM
cucurucu's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 314
cucurucu is on a distinguished road
Arrow

Quote:
Originally Posted by babarmughal
Hi Guys,

How can I make an Ea which lok for the previous BAR open, close, high and low price and then depending on the conditions take long position or short...

Thanks

Babar
You can define some variables:

Code:
double PreviousClose=iClose(Symbol(),NULL,1);
double CurrentClose=iClose(Symbol(),NULL,0);

double PreviousOpen=iOpen(Symbol(),NULL,1);
double CurrentOpen=iOpen(Symbol(),NULL,0);

double PreviousHigh=iHigh(Symbol(),NULL,1);
double CurrentHigh=iHigh(Symbol(),NULL,0);

double PreviousLow=iLow(Symbol(),NULL,1);
double CurrentLow=iLow(Symbol(),NULL,0);
I hope this helps.
Bye.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 05-18-2006, 09:50 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Smile

Quote:
Originally Posted by cucurucu
You can define some variables:

Code:
double PreviousClose=iClose(Symbol(),NULL,1);
double CurrentClose=iClose(Symbol(),NULL,0);

double PreviousOpen=iOpen(Symbol(),NULL,1);
double CurrentOpen=iOpen(Symbol(),NULL,0);

double PreviousHigh=iHigh(Symbol(),NULL,1);
double CurrentHigh=iHigh(Symbol(),NULL,0);

double PreviousLow=iLow(Symbol(),NULL,1);
double CurrentLow=iLow(Symbol(),NULL,0);
I hope this helps.
Bye.

HI cucurucu,

Thanks for your help...can you please tell me how can I define the current price.....is it something like ASK or BID ????

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 05-18-2006, 10:04 PM
pete7's Avatar
Member
 
Join Date: Jan 2006
Posts: 92
pete7 is on a distinguished road
It is Ask and Bid... babarmughal look: there is that saying - RTFM that is the short form of Read The Fucking Manual... Before you ask a question try to find some info in MT4 help files ... it will help you much more and you will find some extra info.
Best Regards
P7
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 05-19-2006, 08:25 AM
cucurucu's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 314
cucurucu is on a distinguished road
Quote:
Originally Posted by babarmughal
HI cucurucu,

Thanks for your help...can you please tell me how can I define the current price.....is it something like ASK or BID ????

Thanks
You can use Ask[] or Bid[], but I preffer using the current close.

double CurrentClose=iClose(Symbol(),NULL,0);

This is the current price, because the bar is not closed, and the CurrentClose is moving. So, let's say that you want the expert to act if the current price is higher than the previous close and the current open is higher than the previous open... you have to code it like this:

Code:
if  ((CurrentClose>PreviousClose) && (CurrentOpen>PreviousOpen)) {......}
Bye.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
High Low Close Indicator dtrade Indicators - Metatrader 4 4 05-21-2007 05:34 AM
Open/close trade on same bar's close? WNW Expert Advisors - Metatrader 4 2 03-29-2007 06:37 AM
Need EA on previous bar High Low breakout manager Expert Advisors - Metatrader 4 1 09-28-2006 11:03 AM
Actual OPEN - Previous CLOSE aristide Metatrader 4 4 04-03-2006 12:33 PM
Previous high and low phildunn Metatrader 4 3 03-21-2006 04:10 PM


All times are GMT. The time now is 05:55 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.