Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - 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 09-13-2006, 10:03 PM
Member
 
Join Date: Sep 2006
Posts: 68
ra300z is on a distinguished road
Only run EA on new bar?

How do you run an EA only on a new bar? I've been running below but after reading the documentation, it obviously won't work.

if (Volume[0]) { return; } // since EA has already acted on this bar.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-13-2006, 11:23 PM
Senior Member
 
Join Date: Mar 2006
Posts: 787
Maji is on a distinguished road
Use the following style:

datetime timeprev=0;


int start()
{

// your code on every tick like trailingstops etc can go here

if(timeprev==Time[0])
return(0);
timeprev=Time[0];

/// your code on new bar goes here

}
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 On
Forum Jump


All times are GMT. The time now is 08:00 AM.



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