Yes I know but I cant back test it. Is that right?
Thanks you for your help.
can't get it to work. Please help
I add this EA to USDCHF and I want it to take a Sell if Bid price hit 30 bar high. (Reverse for buy)
If I make a back test it take buy/sell position every time it hit high/low on USDCHF, it was not the idea. It should only take a sell if EURUSD also hit high the same time as USDCHF.
I know the code is right(I use it for another EA). The thing that is new for me is how to calculate high/low on a different currency pair.
double dLow=Low[Lowest(NULL,0,MODE_LOW,30 ,1)];
double dHigh=High;
double dLow2=Low[Lowest("EURUSD",0,MODE_LOW,30 ,1)];
double dHigh2=High;
if (Bid<=dLow && Bid<=dLow2 ){
if (StopLoss!=0) ldStop=Ask-StopLoss*Point;
if (TakeProfit!=0) ldTake=Ask+TakeProfit*Point;
SetOrder(OP_BUY,Ask,ldStop,ldTake);
}
if (Bid>=dHigh && Bid>=dHigh2){
if (StopLoss!=0) ldStop=Bid+StopLoss*Point;
if (TakeProfit!=0) ldTake=Bid-TakeProfit*Point;
SetOrder(OP_SELL,Bid,ldStop,ldTake);
}
1st thing i see is you have to have something that represents eur's current price which you don't have in your entry logic. perhaps you could use something simular to
Backtester will not pull data from other pairs.
From http://www.metaquotes.net/experts/articles/tester_limits
Using of MarketInfo function generates error ERR_FUNCTION_NOT_ALLOWED_IN_TESTING_MODE(4059), however, correct information about current prices for the symbol under test, about stop level dimensions, about point size, about spread size of any symbol being present in the quotes window is provided.
it does pull data from other pairs but i did not use market info
it does pull data from other pairs
![](https://c.mql5.com/forextsd/smiles/smile.png)
ok, i ran an extremely simple test to verify. Please tell me what i am doing wrong.
Ran in visual mode on EURUSD with NO RESULT:
{
//----
Comment(MarketInfo("GBPUSD",MODE_BID));
//----
return(0);
}AND
int start()
{
//----
Comment(iMA("GBPUSD",0,20,0,0,0,0) );
//----
return(0);
}
it does pull data from other pairs
![](https://c.mql5.com/forextsd/smiles/smile.png)
How'd ya do it? I am dying to know! I've been wanting to do this forever
k gimme a sec
k gimme a sec
yeah,,, i replied before i realized you edited... I am not trying to prove wrong... i really want to know how to accomplish this.
I also edited... this won't work either... Comment(iMA("GBPUSD",1,1,0,MODE_EMA,PRICE_MEDIAN,0) );
What functions are you able to use sucessfully and is there any important data/tester setup necessary?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I am making an EA based on more than one currency pair.
But I can't get it to work. I want to read ex. MA from EURUSD and trade on GBPUSD.
double dSMA=iMA("EURUSD",30,21,0,MODE_SMA,PRICE_CLOSE,1);
double dSMA=iMA("GBPUSD",30,21,0,MODE_SMA,PRICE_CLOSE,1);
Is this correct? Is it possible?
I can't back test it, but will it work live?