Forex
Google

Go Back   Forex Trading > Programming > Metatrader Programming
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
  #111 (permalink)  
Old 07-23-2007, 06:41 PM
MQL4 MQL4 is offline
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Quote:
Originally Posted by codersguru View Post
MODE_ASK?? who told you that the constant MODE_ASK means more than the number 10.

Well, MODE_ASK is used with the function MarketInfo to get the ask price of a currency not the one hosting the EA.

double ask =MarketInfo("EURUSD",MODE_ASK);

so, your code should be:

PHP Code:
double ask   =MarketInfo("EURUSD",MODE_ASK); 
if(
ask == 121.10)
{
    
//do whatever you want.

And about setting time to buy you can use:

PHP Code:
if (TimeHour(TimeCurrent()) == 12 &&  TimeMinute(TimeCurrent()) >= 30)
{
   
//place a buy order

The code above place an order at 12:30 PM
Thank You guys for Your kind help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #112 (permalink)  
Old 07-23-2007, 07:46 PM
MQL4 MQL4 is offline
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Thank You, guys, for Your helpful answers.
I have one more question:

if(bid == 122.15)

I want to replace 122.15 by current market price.

Is there any function that determines current market price?

Thank You.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #113 (permalink)  
Old 07-23-2007, 11:17 PM
MQL4 MQL4 is offline
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Exclamation MQL4 Learning

I have a question:

if(bid == 122.15)

I want to replace 122.15 by current market price.

Is there any function that determines current market price?

Thank You.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #114 (permalink)  
Old 07-23-2007, 11:54 PM
MQL4 MQL4 is offline
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Can someone please answer this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #115 (permalink)  
Old 07-23-2007, 11:55 PM
fxd01 fxd01 is offline
Member
 
Join Date: Nov 2005
Posts: 79
fxd01 is on a distinguished road
Quote:
Originally Posted by MQL4 View Post
I have a question:

if(bid == 122.15)

I want to replace 122.15 by current market price.

Is there any function that determines current market price?

Thank You.
Try this:

if(bid == MarketInfo(Symbol(),MODE_BID))

Hope it helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #116 (permalink)  
Old 07-24-2007, 12:04 AM
Craig Craig is offline
Senior Member
 
Join Date: Feb 2006
Location: New Zealand
Posts: 249
Craig is on a distinguished road
Or this if(bid == Bid) ...
Be aware though that equality of floating point numbers is tricky, you might want something more like this... if (MathAbs(bid - Bid) < Point) (or something).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #117 (permalink)  
Old 07-24-2007, 12:47 AM
MQL4 MQL4 is offline
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
if(bid == MarketInfo(Symbol(),MODE_BID)+10)

Thank You guys, it works! May I ask You another?

if(bid == MarketInfo(Symbol(),MODE_BID)+10)

It is intended that in a certain time the market recognized the price which is for example, x. And will sell 10 pips above this x. I tried this code, and it doesn't work.

Question#2
If within certain seconds the trade is not activated, what is the code syntax for disabling the trade?

Please help!!!

Thank You.

Last edited by MQL4 : 07-24-2007 at 12:51 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #118 (permalink)  
Old 07-24-2007, 03:16 AM
MQL4 MQL4 is offline
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Can someone please help me?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #119 (permalink)  
Old 07-24-2007, 06:06 AM
Shinigami Shinigami is offline
Senior Member
 
Join Date: Nov 2006
Location: Ukraine
Posts: 492
Shinigami is on a distinguished road
Seconds???!?!
Jeez guys learn some MQL4! We don't trade in seconds! We trade in Pips! In ticks! In new prices! But not seconds. You might get a new tick once per few minutes.
If you learn some MQL4 and some market moves, you'll see that if you want to trade in "seconds", you'll have to trade during the most active time. Also, you can get time in seconds from Timexxxx (xxxx - something, just type Time and you'll get a list of possible functions, then look up those functions on mql4.com)
Thats how people learn without being annoying with very simple questions
__________________
MQL4 programming is easy ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #120 (permalink)  
Old 07-24-2007, 06:12 AM
MQL4 MQL4 is offline
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Quote:
Originally Posted by Shinigami View Post
Seconds???!?!
Jeez guys learn some MQL4! We don't trade in seconds! We trade in Pips! In ticks! In new prices! But not seconds. You might get a new tick once per few minutes.
If you learn some MQL4 and some market moves, you'll see that if you want to trade in "seconds", you'll have to trade during the most active time. Also, you can get time in seconds from Timexxxx (xxxx - something, just type Time and you'll get a list of possible functions, then look up those functions on mql4.com)
Thats how people learn without being annoying with very simple questions

Thanks.

What about Question #1? Can't find it on mql4.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
Learning Cycles For New Traders Dan7974 General Discussion 350 01-18-2008 06:04 PM
Learning to code for autotrading GoatT Metatrader Programming 8 01-10-2007 08:55 PM
Self learning expert mrtools Expert Advisors - Metatrader 4 32 10-22-2006 05:29 PM


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