Hello world. I just tried to write a simple trend following EA based on bolinger bands ... How ever it does not execute trades where i really want to ... Could someone tell me how to change it....
For Long position entry i use the Bolinger bands (Price LOW) and for Short positions i use the Bolinger bands (Price HIGH) .
Exiting rule is when the Candle comes back inside the Bolinger bands (Price CLOSE) .
When the candle goes over the Upper Bolinger bands (Price LOW) take Long position the next candle that closes above the upper Bolinger bands.
When the candle goes down the Lower Bolinger bands ( Price HIGH) take Short position the next candle that closes below the Lower Bolinger bands.
That simple but ..... I tried to write it but ..... if someone could check it out would really help me. Thanks. ERICMAN
The first time you run your EA your OrderSelect() and OrderOpenPrice() calls are all going to generate errors, why don't you check to see if you have any orders to close before trying to select a non existing Order ?
See my comments below, there are many errors. Refer documentation or see other EAs in codebase.
OrderSelect(Ticket_L, SELECT_BY_TICKET); //>> if there are no open orders then any call to orderselect & orderopenprice will generate error. Ticket_L = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,0,0,Comments,MAGIC,0,Red); //>> what if ordersend fails.?? where error handling.??

- 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 world. I just tried to write a simple trend following EA based on bolinger bands ... How ever it does not execute trades where i really want to ... Could someone tell me how to change it....
For Long position entry i use the Bolinger bands (Price LOW) and for Short positions i use the Bolinger bands (Price HIGH) .
Exiting rule is when the Candle comes back inside the Bolinger bands (Price CLOSE) .
When the candle goes over the Upper Bolinger bands (Price LOW) take Long position the next candle that closes above the upper Bolinger bands.
When the candle goes down the Lower Bolinger bands ( Price HIGH) take Short position the next candle that closes below the Lower Bolinger bands.
That simple but ..... I tried to write it but ..... if someone could check it out would really help me. Thanks. ERICMAN