thanks e.bravetti i will try to re modify according to your corrections.
Please e.bravetti one more assistance please in the above code i want you to add FOR ME
if BUY POSITION reaches 30pips above bid OR TP THEN close all BUY POSITION
if SELL POSITION reaches 30pips BELOW ask OR TP THEN close all SELL POSITION
PLEASE AM WAITING I APPRECIATE YOUR PREVIOUS SUPPORT
Please e.bravetti one more assistance please in the above code i want you to add FOR ME
if BUY POSITION reaches 30pips above bid OR TP THEN close all BUY POSITION
if SELL POSITION reaches 30pips BELOW ask OR TP THEN close all SELL POSITION
PLEASE AM WAITING I APPRECIATE YOUR PREVIOUS SUPPORT
for( int i = OrdersTotal() - 1; i >= 0; i-- ) { if ( !OrderSelect(i, SELECT_BY_POS) ) continue; if( OrderSymbol() != Symbol() ) continue; //-Close Position Buys if if( OrderType() == OP_BUY && Bid >= (OrderOpenPrice() + (30 * Point)) ) { if ( !OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), 1, clrBlack) ) Alert("your error alert..............."); } //-Close Positione Sell if( OrderType() == OP_SELL && Ask <= (OrderOpenPrice() - (30 * Point)) ) { if ( !OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), 1, clrBlack) ) Alert("your error alert............."); } }
ATTENTION: if you use the reserved word Point in (30 * Point), in forex market with 5 digit or 3 digit, the result of (30 * Point) is = 3 pips.....if you want 30 pips real, you must insert (300 * Point)
ATTENTION: if you use the reserved word Point in (30 * Point), in forex market with 5 digit or 3 digit, the result of (30 * Point) is = 3 pips.....if you want 30 pips real, you must insert (300 * Point)
please sorry for bringing back this thread its just that the e.bravetti code modified for me work fine but the second one did not work well and the issue is that i want to close all
my orders once my profit move 30pip above the open price then
for( int i = OrdersTotal() - 1; i >= 0; i-- ) { if ( !OrderSelect(i, SELECT_BY_POS) ) continue; if( OrderSymbol() != Symbol() ) continue; //-Close Position Buys if if( OrderType() == OP_BUY && ----------------------------------------------- TP=30 ) { if ( !OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), 1, clrBlack) ) Alert("your error alert..............."); } //-Close Positione Sell if( OrderType() == OP_SELL &&------------------------------------------------ TP=30 ) { if ( !OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), 1, clrBlack) ) Alert("your error alert............."); } }
all order close. please any more idea on how to clean code this please.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
please can someone help me with handy code to close all buy or sell when takeprofit is reached or hit
please help me i didnt know all code loops please.thanks
bellow is what i even i try to count down order but yet after that the countdown loop will not work with mt4 strategy test it hangs it
so below is how i coded it but without success i even count down orders yet it didnt work it still close at different price of indicators