int bar, sll; if( Close[0] > bollingerband ){ bar = Bars;} if( bar+1 == Bars){
Since bar is not a static or global its value can ONLY be zero or Bars. Therefor bar+1==Bars will NEVER be true.- when a bar closes outside the bollingerbands
int start(){ // Wait for the start of a new bar. static datetime Time0; if (Time0==Time[0]) return(0); Time0=Time[0]; // Check for close outside BB if (Close[1] > bollingerband){ ...
its nt working..could u plz code it a right way which works perfectly
tasaoirse: its nt working..could u plz code it a right way which works perfectly
|
|
I'm trying to get the EA to record when a bar closes outside the bollingerbands, then initiate a trade if this happened in the previous bar
and the ema's cross or something. My code so far looks like this:
int bar, sll;
if( Close[0] > bollingerband ){
bar = Bars;}
if( bar+1 == Bars){
if(ema1>ema2){
sll = 1}
if ( bar+2 == Bars ){
bar = 0;}
Unfortunately this doesn't seem to work and Ive also tried making it a static as well as a global variable. So I would be most grateful if someone could point me in the right direction