Currency Heat-map EA

 

Hello Al here,

Need help to modify the following code line for mt4. this is a line that buys when all of the different 13 indicators are pointing up, I WOULD LIKE TO CHANGE IT SO IT BUYS WHEN 9 OUT OF 13 ARE POINTING UP, DONT CARE WHICH ONES, JUST 9 OUT OF 13, THATS ALL:

if (Buy1_1 > Buy1_2 && Buy2_1 > Buy2_2 && Buy3_1 > Buy3_2 && Buy4_1 > Buy4_2 && Buy5_1 > Buy5_2 && Buy6_1 > Buy6_2 && Buy7_1 > Buy7_2 && Buy8_1 > Buy8_2 && Buy9_1 > Buy9_2 && Buy10_1 > Buy10_2 && Buy11_1 > Buy11_2 && Buy12_1 > Buy12_2 && Buy13_1 > Buy13_2) Order = SIGNAL_BUY;

ANY IDEAS??

IM WILLING TO SHARE THE EA WHEN DONE.

Al

 

Given the small brick of code you provided, it would be impossible to do. Please post code for the EA.

 

Hello,

here is the attachment of the EA. the line posted earlier is under

//Signal Begin(Entry) title as comment.

let me know and thanks for your interest.

the ea is based on the idea of buying the strongest currency vs the weakest one and

selling the weakest currency vs the strongest one, and the way to do that is by comparing these 13 pairs that will affect the eurjpy trade. when 9 pairs out of 13 goes up, the ea should buy the eurjpy, when vice verse, then sell the eurjpy. that simple.

Thanks

Al

Files:
 

Below is a picture of my charts I created based on buying the strongest currency vs the weakest one and vice versa , all based on ideas of Leveragefx.com by Chris

the EA is based on that idea.

Al

Files:
usdjpy--.gif  69 kb
 

I'm confused. In your first post you want a buy when 9 out of 13 INDICATORS are pointing up. In your next post you want a buy when 9 out of 13 CURRENCY PAIRS are going up. That makes no sense.

 

if (Buy1_1 > Buy1_2 && Buy2_1 > Buy2_2 && Buy3_1 > Buy3_2 && Buy4_1 > Buy4_2 && Buy5_1 > Buy5_2 && Buy6_1 > Buy6_2 && Buy7_1 > Buy7_2 && Buy8_1 > Buy8_2 && Buy9_1 > Buy9_2) Order = SIGNAL_BUY;

// && Buy10_1 > Buy10_2 && Buy11_1 > Buy11_2 && Buy12_1 > Buy12_2 && Buy13_1 > Buy13_2) Order = SIGNAL_BUY;

 

Ok, to me is the same thing, because I use closing price over MA on all the 13 pairs,

but I guess you are right in the world of programming one has to be precise as to what the ea is supposed to do, so I guess,what I really want is 9 currency pairs out of 13 currency pairs to be aligned, before the buy/sell order is triggered. thats the product Im looking for, hope that helps.

and thanks again for your time.

Al

 
Bongo:
if (Buy1_1 > Buy1_2 && Buy2_1 > Buy2_2 && Buy3_1 > Buy3_2 && Buy4_1 > Buy4_2 && Buy5_1 > Buy5_2 && Buy6_1 > Buy6_2 && Buy7_1 > Buy7_2 && Buy8_1 > Buy8_2 && Buy9_1 > Buy9_2) Order = SIGNAL_BUY; // && Buy10_1 > Buy10_2 && Buy11_1 > Buy11_2 && Buy12_1 > Buy12_2 && Buy13_1 > Buy13_2) Order = SIGNAL_BUY;

Hi Bongo, I see what you mean, but I have to also consider 10,11,12 and 13 into the equation . the ea has to look over the 13 pairs and find only a combination of 9 pairs aligned in order to trigger the buy/sell, it doesnt matter which combination but it has to amount to 9 pairs; again, looking over 13 pairs total.

thanks

Al

 
tone40@inbox.com:
Hello Al here,

Need help to modify the following code line for mt4. this is a line that buys when all of the different 13 indicators are pointing up, I WOULD LIKE TO CHANGE IT SO IT BUYS WHEN 9 OUT OF 13 ARE POINTING UP, DONT CARE WHICH ONES, JUST 9 OUT OF 13, THATS ALL:

if (Buy1_1 > Buy1_2 && Buy2_1 > Buy2_2 && Buy3_1 > Buy3_2 && Buy4_1 > Buy4_2 && Buy5_1 > Buy5_2 && Buy6_1 > Buy6_2 && Buy7_1 > Buy7_2 && Buy8_1 > Buy8_2 && Buy9_1 > Buy9_2 && Buy10_1 > Buy10_2 && Buy11_1 > Buy11_2 && Buy12_1 > Buy12_2 && Buy13_1 > Buy13_2) Order = SIGNAL_BUY;

ANY IDEAS??

IM WILLING TO SHARE THE EA WHEN DONE.

Al

int cnt = (Buy1_1 > Buy1_2) + (Buy2_1 > Buy2_2) + .... + (Buy13_1 > Buy13_2);

if(cnt > 8) Order = SIGNAL_BUY;

[/PHP]

or, more easy to understand:[PHP]

int cnt = 0;

if(Buy1_1 > Buy1_2) cnt++;

if(Buy2_1 > Buy2_2) cnt++;

.

.

.

if(Buy13_1 > Buy13_2) cnt++;

if(cnt > 8) Order = SIGNAL_BUY;

 

ive just been using that kind of idea

one way is to......

set up 13 up cariables and 13 down variables

up1....up13

dn1....dn13

set all 13 up to 0 and all down to 0 before reading the indicators

now as each one is true set it to 1

if up1 + up2=up3+up4=up5+up6+...up13==10

then you have 10 out of the 13 true

and viki verki for the downs

 

double base=iCustom(NULL,0,"Traders_Dynamic_Index",2,1);

double S1M=iStochastic(NULL,PERIOD_M5,21,5,12,MODE_SMA,0,MODE_MAIN,1);

double S1S=iStochastic(NULL,PERIOD_M5,21,5,12,MODE_SMA,0,MODE_SIGNAL,1);

double S2M=iStochastic(NULL,PERIOD_M15,21,5,12,MODE_SMA,0,MODE_MAIN,1);

double S2S=iStochastic(NULL,PERIOD_M15,21,5,12,MODE_SMA,0,MODE_SIGNAL,1);

double S3M=iStochastic(NULL,PERIOD_M30,21,5,12,MODE_SMA,0,MODE_MAIN,1);

double S3S=iStochastic(NULL,PERIOD_M30,21,5,12,MODE_SMA,0,MODE_SIGNAL,1);

double S4M=iStochastic(NULL,PERIOD_H1,21,5,12,MODE_SMA,0,MODE_MAIN,1);

double S4S=iStochastic(NULL,PERIOD_H1,21,5,12,MODE_SMA,0,MODE_SIGNAL,1);

double S4M2=iStochastic(NULL,PERIOD_H1,14,3,3,MODE_SMA,0,MODE_MAIN,1);

double S4S2=iStochastic(NULL,PERIOD_H1,14,3,3,MODE_SMA,0,MODE_SIGNAL,1);

double S4M24=iStochastic(NULL,PERIOD_H4,21,5,12,MODE_SMA,0,MODE_MAIN,1);

double S4S24=iStochastic(NULL,PERIOD_H4,21,5,12,MODE_SMA,0,MODE_SIGNAL,1);

double S4Md1=iStochastic(NULL,PERIOD_D1,21,5,12,MODE_SMA,0,MODE_MAIN,1);

double S4Sd1=iStochastic(NULL,PERIOD_D1,21,5,12,MODE_SMA,0,MODE_SIGNAL,1);

up1=0; up5=0;up15=0;up30=0;up60=0;up601=0;up360=0;upd1=0;

dn1=0;dn5=0;dn15=0;dn30=0;dn60=0;dn601=0;dn360=0;dnd1=0;

if (S1S>S1M ) up5=1;

if ( S2S>S2M) up15=1;

if( S3S>S3M ) up30=1;

if( S4S>S4M ) up60=1;

if( S4M2>S4S2 ) up601=1;

if( S4M24>S4S24 ) up360=1;

if( S4Md1>S4Sd1 ) upd1=1;

if (S1S<S1M ) dn5=1;

if ( S2S<S2M) dn15=1;

if( S3S<S3M )dn30=1;

if( S4S<S4M )dn60=1;

if( S4M2<S4S2 )dn601=1;

if( S4M24<S4S24 )dn360=1;

if( S4Md1<S4Sd1 ) dnd1=1;

if(buysell<0 && buysell<dd )dd=buysell;

diff=(stom1-stom1b4);

// Comment (diff," ",diff1," ",diff2);

Comment (up5+up15+up30+up60+up601+up360+upd1," dn ",dn5+dn15+dn30+dn60+dn601+dn360+dnd1, " Biggest drawdown ",dd," bo=",bo," so=",so," diff ",diff);

CloseAllOrders();

{

BUYme = false;

if ( so==0 && up5+up15+up30+up60+up601+up360+upd1==7)upsignal=1;

// if (so==0 && bo>0&& stom1>stom1b4) emergencyup=1;

if (upsignal==1 || emergencyup==1)

{

if (OpenOnTick == 1 && TickPrice > 0 && Close[0] < TickPrice) TradeAllowed = true;

if (CeaseTrading && BuyOrders == 0) BUYme = false;

{

PlaceBuyOrder();

BUYme=true;

}}}

{

SELLme = false;

// if (OpenOnTick && TickPrice > 0 && Close[0] > TickPrice) TradeAllowed = true;

if (OpenOnTick == 1 && TickPrice > 0 && Close[0] > TickPrice) TradeAllowed = true;

if (CeaseTrading && SellOrders == 0) SELLme = false;

if (bo==0 && dn5+dn15+dn30+dn60+dn601+dn360+dnd1==7)dnsignal=1;

//if(bo==0 && so>0&&stom1<stom1b4 <0) emergencydn=1;