Coding an exit at Middle BB in MQL4
What have you tried ? Please show your attempt(s).
Hi Alain,
I have declared "tp" in the order entry section of my code and inserted it into the order modify line.
In the tester, it places the takeprofit at the middle bb value on the entry bar.
I want positions to exit when price >= middle BB (buy), inverse for sell.
This is what I have coded so far:
double tp=iBands(NULL,0,BollingerPeriod,BollingerDeviation,0,0,MODE_MAIN,1);
int buyticket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,0,0,NULL,MagicNumber,0,Green);
if(buyticket>0)OrderModify(buyticket,OrderOpenPrice(),Ask-StopLoss,tp,0,CLR_NONE);
Cheers, Tim
timothysmith78: I want positions to exit...
int buyticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, 3, 0, 0, NULL, MagicNumber, 0, Green); if(buyticket>0) OrderModify(buyticket, OrderOpenPrice(), Ask-StopLoss, tp, 0, CLR_NONE); |
|
|
Hi whroeder,
Thanks for the info, I simply want my open orders to exit when the Ask price is greater than the middle BB. How can I code this into an EA.
Sorry, I'm feeling a little lost. Can you please provide me with some code to help get me started.
Cheers, Tim
Hi guys,
I'm relatively new to building my own EA's and would appreciate some assistance coding a customized exit.
I would like to close both long and short positions at the middle BB.
Thanks in advance for your help!!