Forex



Go Back   Forex Trading > Discussion Areas > Documentation
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-01-2007, 03:39 PM
Member
 
Join Date: Sep 2006
Posts: 14
gigiyoffee is on a distinguished road
programming problem...!

hi,
does anyone knows, in an expert advisor, to program the "OrderSend()" function to open a trade on a symbol different from the one in which the ea is loaded?
thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 05-11-2007, 12:27 AM
ryanklefas's Avatar
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 438
ryanklefas is on a distinguished road
Quote:
Originally Posted by gigiyoffee
hi,
does anyone knows, in an expert advisor, to program the "OrderSend()" function to open a trade on a symbol different from the one in which the ea is loaded?
thanks in advance.

OrderSend(NULL, 0.... )


"NULL" specifies the pair for the order. Null means the current pair. You can put any string (that corresponds to a pair, such as GBPUSD) in there.
__________________
"Don't work harder, work smarter." -- my Java professor

Advertise on The All New FireCell Network
"Where online investing makes sense"

Coder for Hire:
http://firecell.info
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 05-20-2007, 04:30 PM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Quote:
Originally Posted by ryanklefas
OrderSend(NULL, 0.... )


"NULL" specifies the pair for the order. Null means the current pair. You can put any string (that corresponds to a pair, such as GBPUSD) in there.

I thought you also had to use the market info function, I know this works:

extern string paircharta="EURUSD";//whatever symbol you want

tradeticketa = OrderSend(paircharta,OP_BUY,lotsize,MarketInfo(pai rcharta,MODE_ASK),slippage,MarketInfo(paircharta,M ODE_ASK)-stoploss*MarketInfo(paircharta,MODE_POINT),MarketI nfo(paircharta,MODE_ASK)+takeprofit*MarketInfo(pai rcharta,MODE_POINT),"orderstart",magica,0,Blue);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 05-20-2007, 06:43 PM
ryanklefas's Avatar
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 438
ryanklefas is on a distinguished road
Quote:
Originally Posted by wolfe
I thought you also had to use the market info function, I know this works:

extern string paircharta="EURUSD";//whatever symbol you want

tradeticketa = OrderSend(paircharta,OP_BUY,lotsize,MarketInfo(pai rcharta,MODE_ASK),slippage,MarketInfo(paircharta,M ODE_ASK)-stoploss*MarketInfo(paircharta,MODE_POINT),MarketI nfo(paircharta,MODE_ASK)+takeprofit*MarketInfo(pai rcharta,MODE_POINT),"orderstart",magica,0,Blue);
Well, that is the complicated way to do it.
__________________
"Don't work harder, work smarter." -- my Java professor

Advertise on The All New FireCell Network
"Where online investing makes sense"

Coder for Hire:
http://firecell.info
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 05-21-2007, 01:15 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Quote:
Originally Posted by ryanklefas
Well, that is the complicated way to do it.
Seems like there is always an easier way, I usually don't learn it until too late!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 05-21-2007, 04:23 AM
Junior Member
 
Join Date: Mar 2007
Posts: 27
dermusic is on a distinguished road
Try something like the code posted below:

Code:

extern double Lots1=0.2;
extern double Lots2=0.1;
extern int StopLoss =50;
extern int TakeProfit=100;

int Slippage= 3;
int MagicNumber =123;
bool MySignal=false;



string Symbol1,Symbol2;
double orderprice;


int start()
{



Symbol1="USDCHF", Symbol2="GBPUSD";  //remember to put an "m" in if 
                                     //using an Interbankfx mini account, like "GBPUSDm"

if (MySignal==true)
     {
      if(IsTradeAllowed()==true)
          {
          sl=StopLoss*MarketInfo(Symbol1,MODE_POINT):
          tp=TakeProfit*MarketInfo(Symbol1,MODE_POINT):
          orderprice=MarketInfo(Symbol1,MODE_ASK);
          OrderSend(Symbol1,OP_BUY,Lots1,orderprice,Slippage,orderprice-sl,orderprice+tp,"",MagicNumber,0,Blue); 
          }
          {
          sl=StopLoss*MarketInfo(Symbol2,MODE_POINT):
          tp=TakeProfit*MarketInfo(Symbo2,MODE_POINT):
          orderprice=MarketInfo(Symbol2,MODE_ASK);
          OrderSend(Symbol2,OP_BUY,Lots2,orderprice,Slippage,orderprice-sl,orderprice+tp,"",MagicNumber,0,Blue);
          }
          return(0);
     }



}

Last edited by dermusic; 05-21-2007 at 10:23 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 05-21-2007, 04:52 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Nice code dermusic, I like that!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please Help In Programming Ea Goen Questions 0 05-04-2007 08:18 PM
Programming My First EA - - - ???? resalin Setup Questions 4 05-03-2007 04:06 PM
programming problem...! gigiyoffee Metatrader 4 2 05-01-2007 07:36 PM
programming Problem munait Metatrader 4 3 03-06-2006 10:45 AM


All times are GMT. The time now is 08:44 PM.



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