Implementing Fibonacci and ATR into my EA

 

OK....I am working on my first EA and already have figured out the conditions etc and coded such. Please note that I have been using the Expert Advisor Builder here http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ because I do not plan on becoming advanced in MQL or making any other EAs. I tried creating a Fibo indicator that the Expert Advisor Builder-generated MQ4 would "call" but it's not working. Plus, I would prefer all code to be on the same page ;)


My only real difficulties is implementing this-- Basically I want the SL and TP of my orders to be determined by Fibonacci levels taken from the previous candle.

In addition, if the ATR (Average True Range) of the day is smaller than the Fibo-calculated TP, then that supersedes it and becomes the TP instead of the Fibo one. SL stays the same.

I know it can be done because I have seen other EAs with Fibonacci-determined SLs and TPs. It's just a matter of getting it to work with mine.

Here are the EA rules:

LONG- previous candle close > 50-SMA. Entry point <=61.8% Fibonacci level of previous candle. Stop loss = 25.0% Fibonacci level of previous candle. Take profit = lesser of SL x 2 or 5-period ATR.

SHORT- previous candle close < 50-SMA. Entry point >=25.0% Fibonacci level of previous candle. Stop loss = 61.8% Fibonacci level of previous candle. Take profit = lesser of SL x 2 or 5-period ATR.

I would also like a sound alert whenever an order is placed, but the EA should trade automatically (not just give signals).

Any help would be appreciated :)

Thanks!

 

Well this is a whole EA instruction set :)

From what I've seen here people like to help with coding problems, interesting problems or like to be paid for a fully working EA :P While it's not difficult to assemble your EA in mql4, it takes some time and dedication to create a really good EA that doesnt stop working at the first encountered problem and that it's versatile and good enough to be used in real trading.

Maybe you get lucky and some1 codes this for you for the fun of it :P

Or you can post the code you already have and i'm sure ppl will help you with it.

 
peepingtom:
because I do not plan on becoming advanced in MQL
Any help would be appreciated :)
No slaves here, learn to code or pay someone.
 

I think the point of the post is that he is using "the Expert Advisor Builder here https://www.mql5.com/go?link=http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ because... " this then would surely be a question to ask of the builders of this program?

 

Oh and lets not forget this guy

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

 
WHRoeder:
No slaves here, learn to code or pay someone.

I wasn't looking for a "slave" and I don't have money to pay someone, which is why I posted all the instructions here. I am just having trouble with the SLs and TPs, not looking for someone to code the whole thing.

I could care less if any of you make your own EA from the system.

 
Ickyrus:

I think the point of the post is that he is using "the Expert Advisor Builder here https://www.mql5.com/go?link=http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ because... " this then would surely be a question to ask of the builders of this program?


I asked them but their program is very limited on SL and TP integration...stuck with basic # of pips for each....no conditions.

I have also tried Molanis and Traders Visual Studio and neither have Fibonacci.

 

If none of you can offer any guidance, then I would appreciate recommendations for a good MQL guide or tutorials that is simple and has walk-throughs, preferably of what I am trying to achieve.

Thanks.

 

Ok, here.

Mql 4 documentation. if you have any prior coding expoerience, it'll take you 2 hours to get WELL on your way to FINISHing your EA. IF you have prior coding experience, I recommend using that knowledge to backtest your idea before creating EA. It should take less time, less code and give you more testing versatility. That's what I do, because i find the strategy tester extremely undeveloped and unsatisfying to the point of uselessness.

Mql 4 book. if you have absolutely no prior experience with coding go through this first. Start at beginning, go to the end, read fast, no need to memorize everything at once. Shouldnt take you long to grasp the ideas.

Mql 4 technical advisors explained. Technical stuff, use it when you're trying to access data from technical advisors or when you want to know how they work. Go through this after you finish 1) and 2).

Code base for sample code or learning material. If the first 3 things are not enough for you and you've finished your EA and are looking for new ideas, go here, read the topics and find something you like.

Pretty indepth articles on various subjects. I recommend reading the ones on how to safely increase leverage versus equity, and the probability articles. Same as code base, but more theoretical, very interesting reading repository.

Forums for additional help :)

If you start to learn Mql4, ill help you on your way :) You have a good idea, it would be a shame to not put it into (well-written) code.

PS: I'd also offer to code this for you, but am currently busy with 3 of my ideas and couldnt promise you a deadline right now :( However My ETA on all 3 ideas is a week from now, so if you'll still be looking for a coder (or helper) then, message me. I've taken some interest lately in sticking around these forums.

 

It should be very easy to edit/adapt the MACD Sample that comes with MetaTrader 4

For Fibonacci values get the lenght of the previous candle

double myLength=High[1]-Low[1]  ;

double fibNub = myLength*Fib_percent/100. ;

https://docs.mql4.com/indicators/iATR for getting ATR values

https://docs.mql4.com/indicators/iMA for getting Moving average values

MACD Sample is well documented so should be easy to adapt. for example edit the if statement below to reflect your LONG/BUY conditions

      // check for long position (BUY) possibility
      if(MacdCurrent<0 && MacdCurrent>SignalCurrent && MacdPrevious<SignalPrevious &&
         MathAbs(MacdCurrent)>(MACDOpenLevel*Point) && MaCurrent>MaPrevious)
        {

Calculate the TakeProfit and StopLoss values and check they are valid values for your broker obtained using the function MarketInfo()

add PlaySound("Alert.wav"); after ordersend

Sorry but I have my own problems to sort out.

 
Thank you both. This is at least enough information to get me going.
Reason: