Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Metatrader 4


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-15-2007, 04:31 PM
carllos's Avatar
Member
 
Join Date: May 2006
Location: Portugal
Posts: 54
carllos is on a distinguished road
Question Close after 5 bars

Please , can anyone tell me the code for this:

"close a trade after 5 bars"

Thankx

Carllos
__________________
"Hoe ur pips mate?"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-15-2007, 07:01 PM
Junior Member
 
Join Date: Mar 2007
Posts: 2
Pawel is on a distinguished road
Define static global variable:
static int barsAtStart;

After placing order make an assignment
barsAtStart = Bars;

Then if following condition is true close order:
if(Bars - barsAtStart >= 5)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-15-2007, 08:12 PM
Member
 
Join Date: Dec 2005
Posts: 68
asmdev is on a distinguished road
here you go
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-15-2007, 09:14 PM
carllos's Avatar
Member
 
Join Date: May 2006
Location: Portugal
Posts: 54
carllos is on a distinguished road
Smile

Thanks Pawel, I just couldnŽt figure out.
Appreciate it.

Asmdev, thanks for nothing. I DID search the forum for this answer. That was really not necessary. If youŽd post an answer or a link, iŽd appreciate it.

Carllos
__________________
"Hoe ur pips mate?"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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
Open/close trade on same bar's close? WNW Expert Advisors - Metatrader 4 2 03-29-2007 05:37 AM
Appendix 1 - BARS codersguru Lessons 16 02-19-2007 06:52 PM
Inside Bars biggo Metatrader 4 0 01-21-2007 11:56 PM
Day Bars Jonmem Setup Questions 2 12-12-2006 06:31 PM
Trouble with bars pabloschiki Metatrader 4 4 08-29-2006 08:09 PM


All times are GMT. The time now is 09:41 PM.



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