Can someone build this EA for me (Enter trade when there is a one 5mins bar close below or above a trendline)

 

Hi everyone, i started this thread asking someone to kindly edit a copy righted EA and it was brought to my knowledge by some kind fellow(VIFER AND UBZEN) that its better to build a new EA to specifically meet what i want. I will really be grateful if someone helps me out BY BUILDING THE EA FOR ME cos i know noting about coding but iv started learning how to code:

Heres exactly what i want :

CONDITION FOR ENTERING TRADE:

Enter trade when there is a one 5mins bar close below or above a trendline i drew i.e sell when 5mins bar/candle closes below trendline and buy when 5mins bar/candle closes above trendline.

CONDITION FOR CLOSING TRADE:

Close trade when take profit or stop loss target is hit

NB:

defualt parameters

lot 0.12, stop loss 20pips, take profit 50pips


I should be able to change stop loss and take profit by DRAGGING them with my mouse as the trade progresses.

I will be more than happy if you can do this for me.

Thanks and im very grateful.


Franklin
 
You want to attach the .mq4 file instead of the .ex4 file.
 
Hi Ubzen, thanks for your response. i dont really know much about coding. so i thinks thats all i have about the EA. is it going to be impossible for someone to edit the EA if its in .ex4 and what do i have to do to convert it to mq4.
 
franklinadamau:
Hi Ubzen, thanks for your response. i dont really know much about coding. so i thinks thats all i have about the EA. is it going to be impossible for someone to edit the EA if its in .ex4 and what do i have to do to convert it to mq4.

Mere humans cannot read machine code so if you don't have the mq4 then I suggest you contact the EA's author. Also, if you manage to decompile it, please don't post the decompiled code. It will be met with a frosty reception.

If it's a simple EA, then I recommend you build it yourself. You can start here. https://book.mql4.com// The members here will happily help your learning process.

V

 
Viffer:

Mere humans cannot read machine code so if you don't have the mq4 then I suggest you contact the EA's author. Also, if you manage to decompile it, please don't post the decompiled code. It will be met with a frosty reception.

If it's a simple EA, then I recommend you build it yourself. You can start here. https://book.mql4.com// The members here will happily help your learning process.

V



I GOT ANOTHER EA IN mq4 SIMILAR TO THE PREVIOUS ONE IN ex4 THAT I WANTED TO EDIT.....HENCE I JUST CHANGED THE ex4 file to an mq4 file......GUESS SOMEONE WILL KINDLY GET THE JOB DONE FOR ME
Files:
 
franklinadamau:


...... GUESS SOMEONE WILL KINDLY GET THE JOB DONE FOR ME

I guess someone will kindly help you to do the job yourself..... give a man a fish 'n all that...


If you consider this line in the code

if(Ask <= vM && Ask >= vL && OrderFind(MagicBuyStop) == false)

which is just before the pending order send. You don't want to trigger it on the ask but the close of the prev 5 min bar... https://docs.mql4.com/series/iClose would do it.

Obviously you would want to find the corresponding line for the sellstop, but now you know how.... happy fishing

V

 
Viffer:

I guess someone will kindly help you to do the job yourself..... give a man a fish 'n all that...


If you consider this line in the code

which is just before the pending order send. You don't want to trigger it on the ask but the close of the prev 5 min bar... https://docs.mql4.com/series/iClose would do it.

Obviously you would want to find the corresponding line for the sellstop, but now you know how.... happy fishing

V


Hi Viffer,thanksfor the tips on how to code it myself, went through the site you gave me and tried to code myself but i couldnt....tried and tried but still could....U KNOW I CAN LEARN EVERTHING IN A DAY but the site you gave me to learn fromwas really helpful.

However, i still can code it myself thats why i still need someone nice that knows how to code to do it for me....

I WILL REALLY BE GRATEFUL

Thanks Everyone

 

OK, if you read through the code you provided, you will see that after the start () function there are two main blocks of code. One to analyse based on the Buy trend line and one for the sell stop. just looking at buy stop

if(ObjectFind(BuyStop_TrendName) == 0)
     {

which finds and actions based on a (presumably manually) drawn and named trend line.


It defines vH,vM and vL by taking values from the drawn line (all values look like they will be equal.) eg

vM = NormalizeDouble(ObjectGetValueByShift(BuyStop_TrendName,0),Digits);

You can see how this line breaks down with

https://docs.mql4.com/convert/NormalizeDouble

and more importantly for your needs

https://docs.mql4.com/objects/ObjectGetValueByShift

What is important on this line is the shift of 0 is the current bar. Presumably, if you are going to compare with the close of the prev bar you will want to comapre the line value for the prev bar too. The shift in that case would need to be 1.


With the values set, the logic then compares where the current ask is relative to vM and vL. and then sends the pending order.

if(Ask <= vM && Ask >= vL && OrderFind(MagicBuyStop) == false)

You don't want to compare the Ask but the close of the previouse bar so you would need to change Ask's to iClose(NULL,0,1) as linked above.

The sell stop logic is mirrored so it won't be hard to identify the appropriate lines and make the changes.


Given you have a specific objective, and a spot to stand on, I recommend you try and break down and understand what the code is trying to do. There is a list of functions here

https://www.mql5.com/en/forum/122679

read through the code, find the funtions (the purple text) in the list and read how it works. Changing it to run on 5 minute bar close is fairly straightforward.

I think you will value the time spent understanding how it works

V

 
Viffer:

OK, if you read through the code you provided, you will see that after the start () function there are two main blocks of code. One to analyse based on the Buy trend line and one for the sell stop. just looking at buy stop

which finds and actions based on a (presumably manually) drawn and named trend line.


It defines vH,vM and vL by taking values from the drawn line (all values look like they will be equal.) eg

You can see how this line breaks down with

https://docs.mql4.com/convert/NormalizeDouble

and more importantly for your needs

https://docs.mql4.com/objects/ObjectGetValueByShift

What is important on this line is the shift of 0 is the current bar. Presumably, if you are going to compare with the close of the prev bar you will want to comapre the line value for the prev bar too. The shift in that case would need to be 1.


With the values set, the logic then compares where the current ask is relative to vM and vL. and then sends the pending order.

You don't want to compare the Ask but the close of the previouse bar so you would need to change Ask's to iClose(NULL,0,1) as linked above.

The sell stop logic is mirrored so it won't be hard to identify the appropriate lines and make the changes.


Given you have a specific objective, and a spot to stand on, I recommend you try and break down and understand what the code is trying to do. There is a list of functions here

https://www.mql5.com/en/forum/122679

read through the code, find the funtions (the purple text) in the list and read how it works. Changing it to run on 5 minute bar close is fairly straightforward.

I think you will value the time spent understanding how it works

V

Viffer:

OK, if you read through the code you provided, you will see that after the start () function there are two main blocks of code. One to analyse based on the Buy trend line and one for the sell stop. just looking at buy stop

which finds and actions based on a (presumably manually) drawn and named trend line.


It defines vH,vM and vL by taking values from the drawn line (all values look like they will be equal.) eg

You can see how this line breaks down with

https://docs.mql4.com/convert/NormalizeDouble

and more importantly for your needs

https://docs.mql4.com/objects/ObjectGetValueByShift

What is important on this line is the shift of 0 is the current bar. Presumably, if you are going to compare with the close of the prev bar you will want to comapre the line value for the prev bar too. The shift in that case would need to be 1.


With the values set, the logic then compares where the current ask is relative to vM and vL. and then sends the pending order.

You don't want to compare the Ask but the close of the previouse bar so you would need to change Ask's to iClose(NULL,0,1) as linked above.

The sell stop logic is mirrored so it won't be hard to identify the appropriate lines and make the changes.


Given you have a specific objective, and a spot to stand on, I recommend you try and break down and understand what the code is trying to do. There is a list of functions here

https://www.mql5.com/en/forum/122679

read through the code, find the funtions (the purple text) in the list and read how it works. Changing it to run on 5 minute bar close is fairly straightforward.

I think you will value the time spent understanding how it works

V





Hi V thanks alot and im really grateful for your immense support,

Uploaded is the edited version i tried to edit myself just as you told me but im sure i got the whole thing wrong cos it wouldnt even run, right now i think i need to focus on how to make my trading system better then il learn how to code and build EA's later in the nearest future cos i know for sure that its also very important for one to be a profesional trader. Could you plz help me code the EA by editing it to my own taste....Hope you will understand.

Franklin

Files:
edited.mq4  7 kb
 

franklinadamau, like you I'm new to Everything (this forum/coding/trading). 1) Coding takes time to correct as you may have already noticed by now. It's not that its difficult, It just takes time. 2) Coding and Interpreting what the User wants are two worlds apart. 3) Coding correctly what the User wants and making it profitable is another Universe. If I code for you whatever it is you want now, chances are it's not going to become your "Professional Traders" system. Tomorrow, you'll be back wanting me to add another line of code for you.


Because I answered your original post and curious to see where this leads. I'll Attempt (lol) to code a Simple EA for you. I'm not gonna go through your code to figure out what you're intending to accomplish. To save me time and as effort on your part I'm gonna ask you to provide the following in detail and by Line Item. (include as much detail as you think I need to code this program for you).

 

- Condition for entering Trade.

- Condition for closing Trade.

 

If there's not enough detail or it there's too much detail than my skills allow for, I'll be sure to let you know here. 

 
ubzen:

franklinadamau, like you I'm new to Everything (this forum/coding/trading). 1) Coding takes time to correct as you may have already noticed by now. It's not that its difficult, It just takes time. 2) Coding and Interpreting what the User wants are two worlds apart. 3) Coding correctly what the User wants and making it profitable is another Universe. If I code for you whatever it is you want now, chances are it's not going to become your "Professional Traders" system. Tomorrow, you'll be back wanting me to add another line of code for you.


Because I answered your original post and curious to see where this leads. I'll Attempt (lol) to code a Simple EA for you. I'm not gonna go through your code to figure out what you're intending to accomplish. To save me time and as effort on your part I'm gonna ask you to provide the following in detail and by Line Item. (include as much detail as you think I need to code this program for you).

- Condition for entering Trade.

- Condition for closing Trade.

If there's not enough detail or it there's too much detail than my skills allow for, I'll be sure to let you know here.



Hi Ubzen...thanks a million.....heres what i want:

CONDITION FOR ENTERING TRADE:

Enter trade when there is a one 5mins bar close below or above a trendline i drew i.e sell when 5mins bar/candle closes below trendline and buy when 5mins bar/candle closes above trendline.

CONDITION FOR CLOSING TRADE:

Close trade when take profit or stop loss target is hit

NB:

defualt parameters

lot 0.12, stop loss 20pips, take profit 50pips


I should be able to change stop loss and take profit by DRAGGING them with my mouse as the trade progresses.

I will be more than happy if you can do this for me.

Thanks and im very grateful.


Franklin