Download MetaTrader 5

Want to adjust EA Bollinger Band rule..

To add comments, please log in or register
davmartin
33
davmartin  

Hi!

I am backtesting a simple EA I wrote and the EA takes a position when the bar closes outside of the Bollinger Band (either upper or lower).

But what I want is the EA to take a position as soon as the BB is hit (next tick). 


Probably common question, but can't find the information online searching for iBands next tick etc. Most be something with the shift? 

Below the entry rules 

  bbu = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,0); // Bollinger Band Upper
  bbl = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,0);  // Bollinger Band Lower

  if (bbu < Ask) Order = SIGNAL_SELL;
   
  if (bbl > Bid) Order = SIGNAL_BUY;


Thanks:)

whroeder1
16336
whroeder1  

davmartin:

But what I want is the EA to take a position as soon as the BB is hit (next tick).

Probably common question, but can't find the information online searching for iBands next tick etc. Most be something with the shift?

  1. Help you with what? You haven't stated a problem. You have only four choices:
    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 SRC) and the nature of your problem. No free help
    urgent help.
  2. Second sentence is unintelligible.
davmartin
33
davmartin  
whroeder1:
  1. Help you with what? You haven't stated a problem. You have only four choices:
    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 SRC) and the nature of your problem. No free help
    urgent help.
  2. Second sentence is unintelligible.

Very helpful, not! 

Clearly trying to be a smart ass. I am just starting and trying to learn. You just copy paste something that you use as a response to many people who try to figure something out. 


Hopefully someone else can help me further. If my question is not clear, let me know I will try to rephrase. 


All the best! 


Dave 

Marco vd Heijden
Moderator
5798
Marco vd Heijden  

Incomplete code.

whroeder1
16336
whroeder1  
davmartin: Clearly trying to be a smart ass. Hopefully someone else can help me further. If my question is not clear, let me know I will try to rephrase.
I did let you know:
  1. What part of "Help you with what? You haven't stated a problem" was unclear?
  2. What part of "Second sentence is unintelligible," was unclear?
But all you did was insult me. So I will try to remember to not to help you in the future.
Keith Watford
Moderator
10566
Keith Watford  
davmartin:

Hi Marco


Please see the complete code. I don't know what I should adjust so that as soon as the current price hits a bollinger band a market order is pleased. 

What happens now in a backtest is that a market order is placed when the bar closed above (or below) the upper (or lower) band.



Are you backtesting in Every Tick mode?
davmartin
33
davmartin  
Keith Watford:

Are you backtesting in Every Tick mode?

Thanks Keith! That solved the problem :)

To add comments, please log in or register