Questions for EA on multiple pairs

 

Hi, maybe someone can help me here. I'm trying to convert an EA to trade on 4 pairs. However the EA calls the functions : High[i], Low[i], Open[i] or Close[i].

Since the EA should be attached to 4 charts, how can i make sure the functions High[i].... return values from the pair i need ?


Here is one of the function :


//=======================================================================================================
bool divergencelows(int low1,int low2,string pair)
{
double MACD1=iMACD(pair,0,12,26,9,PRICE_LOW,MODE_MAIN,low1);
double MACD2=iMACD(pair,0,12,26,9,PRICE_LOW,MODE_MAIN,low2);
double lowprice1=Low[low1]; EA attached to 4 charts !!
double lowprice2=Low[low2];
if(lowprice1<lowprice2&&MACD1>MACD2)return(1);
else return(0);
}


Thanks. Any help or ideas is appreciated.

 
You can use function iLow(), for example:
iLow("USDCHF",PERIOD_H1,0)
 
Roger:
You can use function iLow(), for example:
iLow("USDCHF",PERIOD_H1,0)

Thanks... I'll try that... And i guess I should have known that.

 
bouchepat wrote >>

Hi, maybe someone can help me here. I'm trying to convert an EA to trade on 4 pairs. However the EA calls the functions : High[i], Low[i], Open[i] or Close[i].

Since the EA should be attached to 4 charts, how can i make sure the functions High[i].... return values from the pair i need ?

Here is one of the function :

//=======================================================================================================
bool divergencelows(int low1,int low2,string pair)
{
double MACD1=iMACD(pair,0,12,26,9,PRICE_LOW,MODE_MAIN,low1);
double MACD2=iMACD(pair,0,12,26,9,PRICE_LOW,MODE_MAIN,low2);
double lowprice1=Low[low1]; EA attached to 4 charts !!
double lowprice2=Low[low2];
if(lowprice1<lowprice2&&MACD1>MACD2)return(1);
else return(0);
}

Thanks. Any help or ideas is appreciated.

Dont be specific on which pair!

It is better to use the common notation-attributes of every pair, thus:

iLow(Symbol(),Period,0).

gives u accurate parameters of whichever pair u a attaching yr EA to.

Thanks.