Forex
Google

Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register FAQ Members List Calendar Search Today's Posts 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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-23-2007, 03:18 PM
hoosain hoosain is offline
Member
 
Join Date: Dec 2005
Posts: 52
hoosain is on a distinguished road
One Trade EA Help needed

Hi, Can anyone let me know the code to make an EA place only one trade a day. If it has opened a trade then irrespective whether it wins or loses that trade it must not open another trade. Many thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-21-2007, 09:15 PM
ryanklefas's Avatar
ryanklefas ryanklefas is offline
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 438
ryanklefas is on a distinguished road
Quote:
Originally Posted by hoosain
Hi, Can anyone let me know the code to make an EA place only one trade a day. If it has opened a trade then irrespective whether it wins or loses that trade it must not open another trade. Many thanks
Very simple to do. What are the conditions of the trade?
__________________
"Don't work harder, work smarter." -- my Java professor

Coder for Hire:
http://www.firecell-fx.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-21-2007, 09:42 PM
Willis11of12's Avatar
Willis11of12 Willis11of12 is offline
Senior Member
 
Join Date: Dec 2005
Posts: 105
Willis11of12 is on a distinguished road
Use this:

First put this up at the top:

int DayOfLastTrade;

Then where you are sending your order in, put this around it:

if (TimeDayOfYear(TimeCurrent())!=DayOfLastTrade)
{
ticket=OrderSend(....
DayOfLastTrade=(TimeDayOfYear(TimeCurrent());
}

That should only allow it to make one trade per day. Hope that is what you wanted.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-27-2008, 03:54 PM
mauro269 mauro269 is offline
Member
 
Join Date: Mar 2008
Posts: 42
mauro269 is on a distinguished road
I've tested it...this doesn't work!
__________________
I'm studing to become an MQL Programmer!
The best strategy to use ForexKiller. Try it: http://forex-killerallday.blogspot.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-27-2008, 11:43 PM
luxinterior luxinterior is offline
Senior Member
 
Join Date: Nov 2006
Posts: 125
luxinterior is on a distinguished road
The problem with that approach would be if you change time frames, have a system crash or power outage etc.

What I do is check the orders total and orders history total. You'd create your own functions and pass in the current day and year. Then check to see if there's either a current open order or one exists in history for the current day and year.

Hope that helps.

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-29-2008, 02:01 PM
mauro269 mauro269 is offline
Member
 
Join Date: Mar 2008
Posts: 42
mauro269 is on a distinguished road
Quote:
Originally Posted by luxinterior View Post
The problem with that approach would be if you change time frames, have a system crash or power outage etc.

What I do is check the orders total and orders history total. You'd create your own functions and pass in the current day and year. Then check to see if there's either a current open order or one exists in history for the current day and year.

Hope that helps.

Lux
Thanks my friend!
__________________
I'm studing to become an MQL Programmer!
The best strategy to use ForexKiller. Try it: http://forex-killerallday.blogspot.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

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
To trade or not to trade Indicators? yaniv_av Indicators - Metatrader 4 1 03-27-2007 01:01 PM
Trade Once Only - Coding Help needed hoosain Suggestions for Trading Systems 5 05-02-2006 02:01 PM
help needed iliaazshareef Suggestions for Trading Systems 2 05-01-2006 06:27 AM


All times are GMT. The time now is 10:13 PM.