EA Slope Direction Line

 

Hello guys,

I am new to MQL4 programming.

I started an EA using the indicator Slope Direction Line Modified.

I checked the EA in very old post https://www.mql5.com/en/forum/178852

https://c.mql5.com/forextsd/forum/49/slopedirectionline_v3_1.mq4 SlopeDirectionLine_v3.mq4.

Test on EURUSD M5, M15, M30 and H1 but not opened any order. It takes a lot to open a new bar

/Trade Only Bar Opening

if(Volume[0]>1 || IsTradeAllowed()==false) return(0);

I did this with the code below and opens the imediatente order

But usually orders open and follow negative

//Entry_Logic

//Culclate Indicator

double SDL_Up = iCustom(NULL, 0, "Slope Direction Line Modified", period, method, price, 0, 1); //Uptrend of Previous Bar Blue Up

double SDL_Dn = iCustom(NULL, 0, "Slope Direction Line Modified", period, method, price, 1, 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(SDL_Up < SDL_Dn) // // Here is your open buy rule

{

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

}

if(SDL_Up > SDL_Dn) // Sell

{

result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,Comentario,MagicNumber,0,Red); // Here is your open Sell rule

}

}

return(0);

}

EA SlopeDirectionLine_v3.mq4. Latimeria is very interesting but it takes too long to open orders

See attached the EA Slope_EA_RB_V2.mq4 I'm testing and the indicator used.

It is possible to make the opening faster orders in EA SlopeDirectionLine_v3.mq4?

There is another free indicator better than the Slope to continue with my studies?

Thank you

Rogério

 
borgesr:
Hello guys,

I am new to MQL4 programming.

I started an EA using the indicator Slope Direction Line Modified.

I checked the EA in very old post https://www.mql5.com/en/forum/178852

https://c.mql5.com/forextsd/forum/49/slopedirectionline_v3_1.mq4 SlopeDirectionLine_v3.mq4.

Test on EURUSD M5, M15, M30 and H1 but not opened any order. It takes a lot to open a new bar

/Trade Only Bar Opening

if(Volume[0]>1 || IsTradeAllowed()==false) return(0);

I did this with the code below and opens the imediatente order

But usually orders open and follow negative

//Entry_Logic

//Culclate Indicator

double SDL_Up = iCustom(NULL, 0, "Slope Direction Line Modified", period, method, price, 0, 1); //Uptrend of Previous Bar Blue Up

double SDL_Dn = iCustom(NULL, 0, "Slope Direction Line Modified", period, method, price, 1, 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(SDL_Up < SDL_Dn) // // Here is your open buy rule

{

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

}

if(SDL_Up > SDL_Dn) // Sell

{

result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,Comentario,MagicNumber,0,Red); // Here is your open Sell rule

}

}

return(0);

}

EA SlopeDirectionLine_v3.mq4. Latimeria is very interesting but it takes too long to open orders

See attached the EA Slope_EA_RB_V2.mq4 I'm testing and the indicator used.

It is possible to make the opening faster orders in EA SlopeDirectionLine_v3.mq4?

There is another free indicator better than the Slope to continue with my studies?

Thank you

Rogério

borgesr

As far as I see, the opening of new orders in SlopeDirectionLine_v3 can not be made faster.

Btw: slope direction line is Hull average. Maybe you can experiment with some of the Hull average variations

 

Hi mladen

Thanks for the quick response

I am new in this language.

In the case you would have to adjust the period below for example?

extern int period=80;

extern int method=3; // MODE_SMA

extern int price=0; // PRICE_CLOSE

Suggests another indicator?

Have any other example of using the Slope?

Thank you

Rogério

 
borgesr:
Hi mladen

Thanks for the quick response

I am new in this language.

In the case you would have to adjust the period below for example?

extern int period=80;

extern int method=3; // MODE_SMA

extern int price=0; // PRICE_CLOSE

Suggests another indicator?

Have any other example of using the Slope?

Thank you

Rogério

Rogério

Check this Hull variation (for start) : https://www.mql5.com/en/forum/general

As of periods : try using the EA optimization to find some acceptable periods

 

Mladen, I try to copile the Hull variation 2.mq4 but have the error 'char' - unexpected token Hull variation 2.mq4 379 11

Error in the line

int char = StringGetChar(s, length);

Using the Metatrader Editor version 5.00 build 1241

Thank you

Rogério

 

Hi Mladen, The compilation error solvede

change char to char1

int char1 = StringGetChar(s, length);

Do you have any example of using this indicator Hull variation 2.mq4 with iCustom?

Thank you

Rogério.

 

Hi

I tried the code below but it does not works appear the same value in both variables

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

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

Follow EA attached file Hull_Variation_RB_EA.mq4

Thank you

Rogério

 

Hi Mladen I was able to use the Hull indicator using an example his.

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

Is there any way to improve the opening of the order not to go negative?

Recommends using another indicator along with the Hull?

Follow attached file Hull_Variation_RB_EA.mq4.

There is still add Stop Loss, Trailing Stop etc.

Thank you

Rogério.

 

Can anybody asssist me with signals that uses the Slope Direction Line indicator.

I need to be signaled when the direction line changes colour - when to buy or sell.

Even if there is a auto trading program that can do the buying and selling for me using this indicator.

Jesus peace.

Marius

 

Rogerio Borges:

I started an EA using the indicator Slope Direction Line Modified.

https://c.mql5.com/forextsd/forum/49/slopedirectionline_v3_1.mq4 SlopeDirectionLine_v3.mq4.

Test on EURUSD M5, M15, M30 and H1 but not opened any order. It takes a lot to open a new bar

/Trade Only Bar Opening

if(Volume[0]>1 || IsTradeAllowed()==false) return(0);

double SDL_Up = iCustom(NULL, 0, "Slope Direction Line Modified", period, method, price, 0, 1); //Uptrend of Previous Bar Blue Up

  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it

  2. Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 forum.) Always use time. New candle - MQL4 forum
    I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
  3. You should write a self documenting function instead of calling iCustom directly, see Detailed explanation of iCustom - MQL4 forum
  4. You pass to the indicator period, method, and price. What are the first three parameters of the indicator?
    //parameters
    extern string  ParamExp = "<<< Indicator Parameters >>>";
    extern bool    UseSimpleJudgement = false;  // if <true> Trend is judged by just 2 bars(It means signal appears "1 bar ealier", but may not be "reliable"). if <false> use 5bars
    extern int     period=80;  // PERIOD
    extern int     method=3;   // MODE_SMA
    extern int     price=0;    // PRICE_CLOSE
    
    Do you really expect that to work?


Reason: