Hull variation 2 indicator EA

To add comments, please log in or register
Rogerio Borges
935
Rogerio Borges  

Hello guys,

I am new to MQL4 programming.

Now I'm trying to use the indicator Hull variation 2

I'm trying the code below but it does not work opens in the wrong direction

//Entry_Logic

//Culclate Indicator

double Hull_Up = iCustom(NULL,0,"Hull variation 2", HMAPeriod,HMAPrice,HMADivisor,0,0);; //Uptrend of Previous Bar Blue Up

double Hull_Dn = iCustom(NULL,0,"Hull variation 2", HMAPeriod,HMAPrice,HMADivisor,0,1); //Dntrend of Previous Bar Red Down

// Buy and Sell Open

double MyPoint=Point;

if(Digits==3 || Digits==5) MyPoint=Point*10;

if(TotalOrdersCount()==0 && AllowTradesByTime()==True)

{

int result=0;

if(Hull_Up > Hull_Dn) // Here is your open buy rule

{

result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,0,0,Comentario,MagicNumber,0,Blue);

}

if(Hull_Up < Hull_Dn) // Here is your open Sell rule

{

result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippag e,0,0,Comentario,MagicNumber,0,Red);

}

}

return(0);

}

In the EA Hull_Variation_RB_EA.mq4 attached the order is opening only once after it is closed does not open a new one.

Many orders open in the right direction indicator but are negative and lose a lot of money.

Attached SLOPE EA that has the same problem and does not close the orders by the indicator.

Could anyone help me to improve this EA?

Thank you.

Rog?rio

To add comments, please log in or register