Download MetaTrader 5

any codebase available for mt4

To add comments, please log in or register
anurag bhargava
535
anurag bhargava  

is there any code base available which could directly open multiple trade on different currency pair based on any single trade pair.

for eg :

suppose I put up any tarde at certain moment for EURUSD,then at the same time multiple trade could be opened with other USD pairs(AUDUSD,GBPUSD,NZDUSD,USDCAD,USDCHF,USDJPY)‌

Alain Verleyen
Moderator
33610
Alain Verleyen  
Osama Shaban
1688
Osama Shaban  

I think you mean, How to open orders for other pairs using one chart ?

I‌f so, use, MarketInfo( ) ...‌ 

anurag bhargava
535
anurag bhargava  
Osama Shaban:

I think you mean, How to open orders for other pairs using one chart ?

I‌f so, use, MarketInfo( ) ...‌ 

Sort of,please can u elaborate
Osama Shaban
1688
Osama Shaban  
anurag bhargava:
Sort of,please can u elaborate


Do you have coding knowledge? at least few ?

I‌f you have, you just need to use MarketInfo( ) as I mentioned before ...

O‌therwise, no way other than putting your code here to help you ...

anurag bhargava
535
anurag bhargava  
Osama Shaban:


Do you have coding knowledge? at least few ?

I‌f you have, you just need to use MarketInfo( ) as I mentioned before ...

O‌therwise, no way other than putting your code here to help you ...


not really,i m using the following,please see how can it be done.
Files:
Osama Shaban
1688
Osama Shaban  

The above code is an indicator ... If you want to open a trade for example on "EURUSD" when the condition you are waiting is detected from the indicator,

t‌hen in the code of your EA, go to the lines where the EA open orders, for example, like this .....

res = OrderSend(Symbol(),OP_BUY,Lot,Ask,3,sl,to,ea_comment,MagicNo,0,Blue); 


‌and replace it with some code like this ...

res = OrderSend(Symbol(),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue);
res = OrderSend(MarketInfo("USDCAD",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend(MarketInfo("AUDUSD",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend(MarketInfo("USDJPY",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend(MarketInfo("EURJPY",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend(MarketInfo("GBPJPY",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 


‌Be sure that all pairs you want to trade are shown in the Market Watch window in your MT4 platform.

anurag bhargava
535
anurag bhargava  

there r no such code in my indicator,i open trade manually.

and that's what i want,when I open certain trade of any curreny pair,then it should automatically open trade in other pairs.

my profile looks something like this

USD profile

now if in this,i open certain trade for EURUSD,it should automatically open trade in other pairs ‌

honest_knave
Moderator
2296
honest_knave  
Osama Shaban:

‌and replace it with some code like this ...

res = OrderSend(Symbol(),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue);
res = OrderSend(MarketInfo("USDCAD",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend(MarketInfo("AUDUSD",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend(MarketInfo("USDJPY",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend(MarketInfo("EURJPY",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend(MarketInfo("GBPJPY",MODE_ASK),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue); 

res = OrderSend(Symbol(),OP_BUY,Lot,Ask,3,sl,tp,ea_comment,MagicNo,0,Blue);
res = OrderSend("USDCAD",OP_BUY,Lot,MarketInfo("USDCAD",MODE_ASK),3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend("AUDUSD",OP_BUY,Lot,MarketInfo("AUDUSD",MODE_ASK),3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend("USDJPY",OP_BUY,Lot,MarketInfo("USDJPY",MODE_ASK),3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend("EURJPY",OP_BUY,Lot,MarketInfo("EURJPY",MODE_ASK),3,sl,tp,ea_comment,MagicNo,0,Blue); 
res = OrderSend("GBPJPY",OP_BUY,Lot,MarketInfo("GBPJPY",MODE_ASK),3,sl,tp,ea_comment,MagicNo,0,Blue); 

You might also want to check the result of each OrderSend().

Osama Shaban
1688
Osama Shaban  
anurag bhargava:

there r no such code in my indicator,i open trade manually.

and that's what i want,when I open certain trade of any curreny pair,then it should automatically open trade in other pairs.

my profile looks something like this

USD profile

now if in this,i open certain trade for EURUSD,it should automatically open trade in other pairs ‌


As you are thinking to open order/orders, this means you need an EA or script.

Y‌ou can't do that using the indicator directly !.

Y‌ou need to code an EA by linking this indicator to it (if you like) then you feed the EA with the logic to open the other pairs using one/current chart.

Osama Shaban
1688
Osama Shaban  
honest_knave:

You might also want to check the result of each OrderSend().


Sure :)
12
To add comments, please log in or register