|
|||||||
| 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 |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Possible to trade different currency than the one EA is attached to?
Hi guys,
Wondering if anyone can help me out - I'm trying to write an EA that will be attached to the EURUSD chart, but want it occasionally to place a USDCHF trade as well as the EURUSD ones. Is this possible? I tried the following code: OrderSend("USDCHF",OP_BUY,Lots,Ask,3,StopLoss*Poin t,TakeProfit*Point,"UC",55555,0,Green) But I kept getting the message "unknown symbol name USDCHF for OrderSend function". Is this because the EA is attached to the EURUSD chart? And is there any way to tell the EA to buy a different currency (and then later to close it)? Any suggestions would be very appreciated! (Oh, and does anyone know of an EA that does this? I find it helpful to look at the code of working EA's when I'm struggling with a problem.) Tim |
|
||||
|
Quote:
I'm writing right now an article about this issue, please check it at: http://www.metatrader.info/node/124 |
|
|||
|
Quote:
I look forward to reading the article when it's ready Tim |
|
|||
|
Hi CG.... it was very interesting reading your tutorial, but I still don't understand exactly how to tell Metatrader to buy or sell a different currency from the one the EA is attached to. Would it be possible for you to post an example of some code that does this? For example, when the EA is attached to EUR/USD, how do I tell it to buy USD/CHF at the current Ask price?
Originally I tried: OrderSend("USDCHF", OP_BUY, Lots, Ask, 3, StopLoss*Point, TakeProfit*Point, "UC", 55555, 0, Green) which didn't work. Is this because I didn't use the ibars Function first, or have I got the code completely wrong? Can you, or anyone else help with this? Tim |
|
|||
|
Hey CG..... I just found your article on Hedging which helped with my original question(and helped me understand the code snippets below), but when I try to backtest your Hedging.mq4 EA I get an error message saying "invalid price for OrderSend function" when it tries to place the USDCHF order. Do you know why this is happening?
|
|
||||
|
Quote:
Trading is permitted for the symbol under test only, no portfolio testing Attempts to trade using another symbol will return error Please review this article: http://articles.mql4.com/72 So, this kind of program have to forward tesing only! |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Easiest Currency Pair to Trade | yyc196 | General Discussion | 12 | 04-03-2007 02:06 PM |
| Trade muliple currency Pairs | rbowles | Metatrader 4 | 5 | 08-13-2006 05:51 AM |
| Why EA is not working when attached | josephine | General Discussion | 5 | 03-04-2006 06:47 PM |