Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions
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 12-22-2005, 07:11 PM
maxime_mataf maxime_mataf is offline
Junior Member
 
Join Date: Nov 2005
Posts: 11
maxime_mataf is on a distinguished road
I want only one trade per day !

Hi all,

I develop my first expert advisor. I've just a small problem. I don't want more than one BUY order and SELL order per day.

By example, if I have a signal for open a Buy order : It won't be open if a Buy order was opened during the day (00h00 GMT ==> 00h00 GMT) and it's the same thing for the short position : if I have a signal for open a Sell order, it won't be open if a Sell order was opened during the day.

So the EA can open only one Buy order and only one Sell order per day.

How to develop that ??

Thank you

Max
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-22-2005, 07:24 PM
schwager schwager is offline
Member
 
Join Date: Oct 2005
Location: Germany
Posts: 62
schwager is on a distinguished road
example

example.......
Attached Files
File Type: mq4 GBP9AM.mq4 (7.5 KB, 54 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-22-2005, 09:27 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow

Quote:
Originally Posted by maxime_mataf
Hi all,

I develop my first expert advisor. I've just a small problem. I don't want more than one BUY order and SELL order per day.

By example, if I have a signal for open a Buy order : It won't be open if a Buy order was opened during the day (00h00 GMT ==> 00h00 GMT) and it's the same thing for the short position : if I have a signal for open a Sell order, it won't be open if a Sell order was opened during the day.

So the EA can open only one Buy order and only one Sell order per day.

How to develop that ??

Thank you

Max
Max,

I just want to ask you, what if this order (Buy or Sell) hasn't been opened today (Ex: Yesterday)?
Do you want to open a new order in this case or you want to open only one order per chart?

Anyway, you can use something like this to check if the order has been opened today or not:

PHP Code:
if(OrderSelect(1SELECT_BY_POS)==true)
  {
   if(
TimeToStr(OrderOpenTime(),TIME_DATE ) != TimeToStr(CurTime(),TIME_DATE ))
     {
       
//open new order  
     
}
  } 
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-23-2005, 04:05 PM
maxime_mataf maxime_mataf is offline
Junior Member
 
Join Date: Nov 2005
Posts: 11
maxime_mataf is on a distinguished road
Hi,

I want maximum : one Buy order and one Sell order per day and per chart.

So, in one day and on one chart, we can have :

1. no order
2. one Buy order
3. one Sell order
4. one Buy order and one Sell order.

That's all the possibilities.

I don't know if you have understand, I know my english is very bad so it's not simple to explain for me...


This is an extract from my EA : If you can help me...

Thx


PHP Code:
   int total=OrdersTotal();
   if(
total<1
    {
     if(
AccountFreeMargin()<(1000*Lots))
      {
       Print(
"Votre capital est insufisant. Votre marge est de "AccountFreeMargin());
      }
       
     if(
Ask==....blablabla 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-28-2005, 08:59 PM
maxime_mataf maxime_mataf is offline
Junior Member
 
Join Date: Nov 2005
Posts: 11
maxime_mataf is on a distinguished road
Anybody can help me ?

I don't know how to do that !
There should not be new order if there were an order opened since 00h00. I don't know if you understand...
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


All times are GMT. The time now is 06:33 AM.