help with HULL MA RUSSIAN COLORS

 

Hi there,

 I'm not a coder, but i try to solve my own problems before asking.

 

So i am develoing an EA, that triggers orders based on Stochastic and RSI levels. I want to add this Hull Ma indicator i attach. I have problems with the conditions for trend up trend down, maybe i will need to modify theindicator, and that is my greatest problem, Indicator uses 3 buffer, i think for buy condition i gave its working but there is no way to make it work for sell condition. Really need help because i am stuck in this for about 2 monthnow trying to look for solution.

 This is how i did:

 

I want that the Indicator takes the trend in daily TF:

     double currentHTF   = iCustom(NULL,1440,"HMA_Russian_Color",HMA_PERIODHTF,3,0,0);

     double previous1HTF = iCustom(NULL,1440,"HMA_Russian_Color",HMA_PERIODHTF,3,0,1);

 

    {

     if(currentHTF > previous1HTF)

     {

     ...........

               {

                           openOrder(getLots(),MagicNumber,OP_BUY, _sl,_tp);

               }    

     }

 

  This seem to work for buy, but for sell i use the same if(currentHTF < previous1HTF)  and does not find the down trend, and dont trigger any order...... 

 I was told to use it like this:

 

  double current   = iCustom(Symbol(),0,"HMA_Russian_Color",20,3,0,0);

double previous1 = iCustom(Symbol(),0,"HMA_Russian_Color",20,3,0,1);
double previous2 = iCustom(Symbol(),0,"HMA_Russian_Color",20,3,0,2);

if (current>previous1 && previous1<previous2) 
{
   //  slope changed to up
}
if (current<previous1 && previous1>previous2) 
{
   //  slope changed to down
}  

 

The problem is that if i execute it this way, i have to forget of my current triggering conditions and use only to trigger at the slope changes, not between them. So for uptrend shall "trade" from

"slope change to up" - untill - "slope change to down" 

 Same for sell.....

 

Please help me with conditions or if its needed to change the code of the indi, please help ...

 

THanks 

Files:
 
double current   = iCustom(Symbol(),0,"HMA_Russian_Color",20,3,0,0);
double previous1 = iCustom(Symbol(),0,"HMA_Russian_Color",20,3,0,1);
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Detailed explanation of iCustom - MQL4 forum 
  3. Colored indicators use multiple buffers, one per color. You are looking at only one buffer, therefor one color.
 

I can't attach the code, don't works SRC for complete indicator... it is attached in first post

 

I don't get it icustom how to work it out, i have read this about 4 times..

 

only get how to write, and that previous number before last one is buffer, and last number is shift, now, for current, last number 0 is shift = 0?? last number for previous1 = 1, is shift 1? and last number for previous2 = 2, is shift 2??

 

and the colors are 0, 1, or 2?? if it is 0,0,0 then there is only one color (color 0), and for buy has to be  color blue and for sell color red... how do i write this is my understanding correct?? and then how do i set conditions into EA???

 

 i understand period = 20

                    type    = 3

                    price   = 0 

 
daniel1983:

I can't attach the code, don't works SRC for complete indicator... it is attached in first post

So edit your first post and re-post the code snippet using the SRC button . . .  you could at least do that.  SRC button
 

Ok, i got it, sorry did understand something else,

 

i think maybe the indicator has desactivated the buffer i need for the conditions, can somebody check please? i had a look at another indicator that looks very different using 5 buffer instead of 3...   formula is very similar, but it ads other features, like drawing support and resistance lines, but i do not need them and makes everything more slow. i don't understand how should i write the conditions for "between" slope start and slope end, maybe it could be possible to do it like with Time to trade between hour 1 and hour 10, or something like that, maybe not necessarily into the conditions for the triggering or not of the orders, really feeling confused in wich way or path to take for this...conditions, i think i have my EA allmost finished if it is not for this trend condition idea i like...and my only problem is defining the conditions for sell orders, buy orders i think is working good as it starts at change of slope and ends at change of slope...but for sell, it has become kind of impossible untill now...

 

Thanks 

 
daniel1983:

Ok, i got it, sorry did understand something else,

 

i think maybe the indicator has desactivated the buffer i need for the conditions, can somebody check please?  


Please read the thread about using  iCustom()  and also the documentation . . .

The Indicator has 3 extern variables . . .

extern int       period=21; 
extern int       method=0;                         // MODE_SMA 
extern int       price=0;                          // PRICE_CLOSE 

 your code is not specifying all three . . .

double current   = iCustom(Symbol(),0,"HMA_Russian_Color",20,3,0,0);

double previous1 = iCustom(Symbol(),0,"HMA_Russian_Color",20,3,0,1);
double previous2 = iCustom(Symbol(),0,"HMA_Russian_Color",20,3,0,2);

 
In an iCustom() call the last 2 variables are  the buffer number and the shift . . . that leaves your code passing 2 variables,  which 2 are they ?  how can iCustom know which 2 they are ?  you should specify all 3.

 
RaptorUK:


Please read the thread about using  iCustom()  and also the documentation . . .

The Indicator has 3 extern variables . . .

 your code is not specifying all three . . .

 
In an iCustom() call the last 2 variables are  the buffer number and the shift . . . that leaves your code passing 2 variables,  which 2 are they ?  how can iCustom know which 2 they are ?  you should specify all 3.

 

 

iCustom passes the parameters to the indicator in the order they are specified, starting from the first. In case no value is specified for some parameters, the default value defined in the indicator is used. There is no need to specify all parameters, though it's certainly clearer to specify all.
 
daniel1983:

Ok, i got it, sorry did understand something else,

 

i think maybe the indicator has desactivated the buffer i need for the conditions, can somebody check please? i had a look at another indicator that looks very different using 5 buffer instead of 3...   formula is very similar, but it ads other features, like drawing support and resistance lines, but i do not need them and makes everything more slow. i don't understand how should i write the conditions for "between" slope start and slope end, maybe it could be possible to do it like with Time to trade between hour 1 and hour 10, or something like that, maybe not necessarily into the conditions for the triggering or not of the orders, really feeling confused in wich way or path to take for this...conditions, i think i have my EA allmost finished if it is not for this trend condition idea i like...and my only problem is defining the conditions for sell orders, buy orders i think is working good as it starts at change of slope and ends at change of slope...but for sell, it has become kind of impossible untill now... 

By definition, buffer 0 has a value only when indicator value is raising, otherwise it's value is EMPTY_VALUE. Same for buffer 1, but for decreasing value. So you have to get the value for both buffers to check a change of slope's direction.

 

I don't understand what you mean by "between slope start and slope end"? 

 

Thank you,

 Ok, lets see:

 

input int            period              = 20; 
input int            method              =  3; 
input int            price               =  0; 

double current   = iCustom(Symbol(),0,"HMA_Russian_Color",period,method,price,0,0);
double previous1 = iCustom(Symbol(),0,"HMA_Russian_Color",period,method,price,1,0);
double previous2 = iCustom(Symbol(),0,"HMA_Russian_Color",period,method,price,2,0);

If is this what you mean RaptorUK, how do i write the conditions?? 

Mr. Angevoyageur, is this correct?

 and for the conditions, what i mean with change of slope or buy -sell area is this:

  BUY-SELL AREA FOR ORDERS TO TRIGGER DAILY CHART

 
daniel1983:

Thank you,

 Ok, lets see:

 

Mr. Angevoyageur, is this correct?

 and for the conditions, what i mean with change of slope or buy -sell area is this:

 

One way to do it :

double current_buy   = iCustom(Symbol(),0,"HMA_Russian_Color",period,method,price,0,0);
double current_sell  = iCustom(Symbol(),0,"HMA_Russian_Color",period,method,price,1,0);
double previous_buy  = iCustom(Symbol(),0,"HMA_Russian_Color",period,method,price,0,1);
double previous_sell = iCustom(Symbol(),0,"HMA_Russian_Color",period,method,price,1,1);

if(previous_buy==EMPTY_VALUE && current_buy!=EMPTY_VALUE)
{
   // Slope change Up, you just enter a BUY AREA
}
if(previous_sell==EMPTY_VALUE && current_sell!=EMPTY_VALUE)
{
   // Slope change Down, you just enter a SELL AREA
}
 

Wow i will try this,

This is very different to what i have try, thanks. 

 

 Then to close them at slope change, should be something like this: 

 

for(int cnt = 0 ;cnt<OrdersTotal();cnt++)
   {
      if(!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
         continue;

      //CHECK FOR CLOSE

      if(OrderType() == OP_BUY)
      {
         if(previous_sell==EMPTY_VALUE && current_sell!=EMPTY_VALUE)
         
            {
               closeOrder(OrderTicket(),9999);
               if(DebugMode == Yes) Print("CLOSING AT CHANGE OF SLOPE");
               break;
            }
      }

 

 Thanks i will try this

 

Daniel1983