Something like script or ea...
Hello, I wanted to shut all OPEN positions after a certain P/l ($) is reached or after a certain pips is reached or after a certain% of profits concerning account balance (Total pips or Total profits of Open Trades).
For 1st alternative, eg pips=1000 (so script will shut ALL opened transactions if TOTAL pips=gt;1000pips)
2nd alternative, eg profit=$500 (script will shut ALL opened transactions once TOTAL P/L$ for these transactions =gt; $500)
3rd alternative, eg, profitpercent =2. Calculation is every transaction P/L ($)/account balance/100. When trade's P/L=$100 and balance = $5000, thats 2%, so that transaction. The script will go thru each and every trade and close it automatically. Its turned into an EA but just doesnt trade
So far as I know, there is no such thing as shutting on Meta 4. EA or the script will place all trades in to a que and implement them. The orders will probably get closed but not instantly and it may be that by now all open positions closed, you may have partial profit or even a loss .
Rahi, I believe so.
Can you understand if I have 10 open trades, and want to shut all, which choice will close all of them faster?
1. Use CloseAll script or EA
or
2. Set all trades to have TP goal or SL goal?
best rgds,
Setting up TP and SL Targets of trades will give you an advantage of the close option. When using EA to shut will have a limit order appliion and also on Market strike will probably likely be an open order. If you only have 10 orders to stress, then the implementation period may not differ significantly, but the usage of SL and TP will give you the asking price. Have you ever thought of using API? API will have a minimal latency rate compare to Framed Meta 4 order flow.
Regards,
Rahi1
Hello everybody,
I've a problem closing all place by the click of the button I have created. Can somebody please assist me?
I just started coding... Here is what I have:
NABtnState=ObjectGet(BtnCloseAll,OBJPROP_STATE);
bool close;
if(ObjectGet(btnCloseAll,OBJPROP_STATE))
{
ObjectSet(btnCloseAll,OBJPROP_STATE,0);
for(int I=OrdersTotal()-1;igt;=0;I--)
OrderSelect(I,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUY)
near =OrderClose(OrderTicket(),OrderLots(),MarketInfo(O rderSymbol(),MODE_BID),3,Green);
RefreshRates();
if(OrderType()==OP_SELL)
near =OrderClose(OrderTicket(),OrderLots(),MarketInfo(O rderSymbol(),MODE_ASK),3,Green);
RefreshRates();
I=0;
Thanks!
Jane
Can somebody pse help me with the following ea, when I drag it on the chart, nothing happens:
{
OrderSelect(cc,SELECT_BY_POS);
if (TimeCurrent() - OrderOpenTime() gt;= (TradesWillExpireMins*60) OrderMagicNumber()==MagicNumber) - THIS IS THE LINE 1529 Together with the ERROR
if (ShowAlerts) Alert(Trade expiry time has been reached, Therefore a;; baslet Transactions were closed);
CloseBasket=true;//This will force basket trade Closing on Another tick
return;
ERROR message when I compiled it
1.'TimeCurrent' - constant expression demanded Multi purpose trade manager.mq4 1529 15
2.' {' - unexpected token Multi purpose trade manager.mq4 1529 14
thank you
Inserted Code if (TimeCurrent() - OrderOpenTime() gt;= (TradesWillExpireMins*60) OrderMagicNumber()==MagicNumber)
Why do you possess the {} in there. Removing them may help