- close2 was below the band
- close1 was above the band
- current prices is different X% vs close1
if(close1 > bbUpper[1] && close2 < bbUpper[0] && current_bid < X*close1){
You wrote close2 below the upper band. You wrote current price is below a fraction of price (always false).
So write it that way. Exactly that way.
bool c1 = close2 < …; // close2 was below the band bool c2 = close1 > bbUpper[1]; // close1 was above the band bool c3 = MathAbs( Bid - close1 ) > … // current prices is different X% vs close1 if(c1 && c2 && c3){
Thanks for your help, but still no idea how to do it :(
E.g.
Close1 = 10, bbUpper1 = 9
Close2 = 7, bbUpper0 = 8
So, I would like to sell when:
close2 < bbUpper0 - correct
close1 > bbUpper1 - correct
and also when price goes down by 1% so I would like to sell, when the price is 9.99
Im not sure if MathAbs helps here
You have only four choices:
-
Search for it (CodeBase or Market). Do you expect us to do your research for you?
- Beg at:
- Coding help - MQL4 programming forum
- Make It No Repaint Please! - MQL4 programming forum
- MT4 to MT5 code converter - MQL5 programming forum
- Please fix this indicator or EA - General - MQL5 programming forum
- Requests & Ideas (MQL5 only!) - Expert Advisors and Automated Trading - MQL5 programming forum
- Indicator to EA Free Service - General - MQL5 programming forum
-
MT4: Learn to code it.
MT5: Begin learning to code it.If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
-
Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2019)
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
No free help (2017)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Im writing some simple EA based on bollinger bands, i would like to use IF function:
When I put current_BID < X close1 EA does not make any trades.
Short story long, I would like to make an order if:
- close2 was below the band
- close1 was above the band
- current prices is different X% vs close1
Thanks in advance,
it might be silly question for you guys, but I dont have any experience with coding :) thanks