Download MetaTrader 5

multi currency in back test!

To add comments, please log in or register
Deposit to your account in any convenient way. There are 4 of them here!
Mohammad Soubra
24983
Mohammad Soubra 2016.01.02 14:30 

Hi 





is it possible to create an EA that trades multi currency in the same EA???? 


any body know ?? 





* I have the code for that and it is not working with more than a currency pair 

 

void OnTick() 
{ 
string eurusd = "EURUSD", eurjpy = "EURJPY", usdcad = "USDCAD", gbpnzd = "GBPNZD", usdchf = "USDCHF"; 

int ticketeurusd = OrderSend (eurusd, OP_BUY, 0.01, Ask, 5, 0, 0, eurusd, 1, 0, clrNONE); 
int ticketeurjpy = OrderSend (eurjpy, OP_BUY, 0.01, Ask, 5, 0, 0, eurjpy, 2, 0, clrNONE); 
int ticketusdcad = OrderSend (usdcad, OP_BUY, 0.01, Ask, 5, 0, 0, usdcad, 3, 0, clrNONE); 
int ticketgbpnzd = OrderSend (gbpnzd, OP_BUY, 0.01, Ask, 5, 0, 0, gbpnzd, 4, 0, clrNONE); 
int ticketusdchf = OrderSend (usdchf, OP_BUY, 0.01, Ask, 5, 0, 0, usdchf, 5, 0, clrNONE); 
}
Marco vd Heijden
Moderator
4699
Marco vd Heijden 2016.01.02 15:50  

I only work with multi currency ea's.

but you should use OnTimer() as the OnTick() only works for incoming ticks from the chart symbol.

And its not possible in the MT4 backtest only on live market,.

Mohammad Soubra
24983
Mohammad Soubra 2016.01.02 17:32  
Marco vd Heijden:

I only work with multi currency ea's.

but you should use OnTimer() as the OnTick() only works for incoming ticks from the chart symbol.

And its not possible in the MT4 backtest only on live market,.

Ok thanks marko
But why OnTimer()   ??
Marco vd Heijden
Moderator
4699
Marco vd Heijden 2016.01.02 17:54  

Otherwise the robot will only process on a tick coming in from the chart symbol.

Say you run on EURUSD then the code will only be executed whenever a tick comes in for EURUSD.

Not good so you run OnTimer() to keep it going over SymbolsTotal().

Mohammad Soubra
24983
Mohammad Soubra 2016.01.02 18:03  
Marco vd Heijden:

Otherwise the robot will only process on a tick coming in from the chart symbol.

Say you run on EURUSD then the code will only be executed whenever a tick comes in for EURUSD.

Not good so you run OnTimer() to keep it going over SymbolsTotal().

Ok seems very closed to use the OnTimer or the OnTick Twice will give same results


Do u have a solution for the history center that has a limited periods ...
Do u know from where these people are doing back test for over than 10 years in 15m or 30m chart !

I only found less than a year available for each pair in 15m chart
Mitsubishi4arab
379
Mitsubishi4arab 2016.01.02 18:26  
Marco vd Heijden:

Otherwise the robot will only process on a tick coming in from the chart symbol.

Say you run on EURUSD then the code will only be executed whenever a tick comes in for EURUSD.

Not good so you run OnTimer() to keep it going over SymbolsTotal().

Mr Marco
Seems you are an expert

can help me to code a simple script for HEDGE
Marco vd Heijden
Moderator
4699
Marco vd Heijden 2016.01.02 18:45  
Mitsubishi4arab:
Mr Marco
Seems you are an expert

can help me to code a simple script for HEDGE

We do not have a clear description of what it is you want to do.

If you want to diversify risk by automatically opening up a hedged counter position, which can be a good thing,

You let the EA listen for orders and upon sensing a new order, have it open up the additional position.

Marco vd Heijden
Moderator
4699
Marco vd Heijden 2016.01.02 18:49  
Mohammad Soubra:
Ok seems very closed to use the OnTimer or the OnTick Twice will give same results


Do u have a solution for the history center that has a limited periods ...
Do u know from where these people are doing back test for over than 10 years in 15m or 30m chart !

I only found less than a year available for each pair in 15m chart
If you are looking for multiple symbol backtesting, this can only be done in MT5.
Mohammad Soubra
24983
Mohammad Soubra 2016.01.02 18:53  
Marco vd Heijden:
If you are looking for multiple symbol backtesting, this can only be done in MT5.
Really ???
THANKS man 



Good information
I dont know before
Mitsubishi4arab
379
Mitsubishi4arab 2016.01.02 18:57  
NINJA Marco
U r Ninja
Mitsubishi4arab
379
Mitsubishi4arab 2016.01.02 18:57  
Marco vd Heijden:

We do not have a clear description of what it is you want to do.

If you want to diversify risk by automatically opening up a hedged counter position, which can be a good thing,

You let the EA listen for orders and upon sensing a new order, have it open up the additional position.

Have code ?
To add comments, please log in or register