Aurix Exchange

How to improve your EA

vit007

Member
Here is the cod that will help your EA to stop putting trades against the trend. You can use it for any existing EA or if you create a new one.

IN externals
//-----------------------------------------------------------
extern int PeriodPower =13;
extern int Period_Bulls =11;
extern int Period_Bears =10;
//-----------------------------------------------------------
int start() ) :
//================ ============================
double Bears_array[30]; int cx=0; while (cx<31)
{Bears_array[cx]= iBearsPower(NULL, 0, PeriodPower,PRICE_CLOSE,cx); cx++; }
ArraySetAsSeries(Bears_array,true);
double MA_Bears =iMAOnArray(Bears_array,0,Period_Bears,1,MODE_SMMA ,0);

double Bulls_array[30]; int lx=0; while (lx<31)
{Bulls_array[lx]= iBullsPower(NULL, 0, PeriodPower,PRICE_CLOSE,lx); lx++; }
ArraySetAsSeries(Bulls_array,true);
double MA_Bulls =iMAOnArray(Bulls_array,0,Period_Bulls,1,MODE_SMMA ,0);

double Delta = MA_Bears + MA_Bulls;
/*Comment ("Delta ", Delta ,"\n") */
//==================================================
After you just need to add in the cod for BUY
if ((Delta>=0) && ... ...

and for the cod for SELL
if ((Delta<=0) && ... ...

I?m not a coder , just found this cod on the net and start adding to my EAs and the result is very good.
Vit
 

krish

Member
hi
hope it will be very usefull, let me try it out and share the results
thanks
Regard
Krish:)
 

Capella

Active member
VIP Member
hi
hope it will be very usefull, let me try it out and share the results
thanks
Regard
Krish:)

There are many ways to calculate trends, and this is one of several ways. I will give it a try though to see how it compares to other methods.

Thanks for the tip though :)
 

Aurix Exchange
Top