Want to adjust EA Bollinger Band rule..

 

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:)

 

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.
 
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 

 

Incomplete code.

 
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.
 
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?
 
Keith Watford:

Are you backtesting in Every Tick mode?

Thanks Keith! That solved the problem :)

Reason: