Is it possible to close all positions on mt4?
Page 1 of 504 1 2 3 ... LastLast
Results 1 to 10 of 31

Thread: Is it possible to close all positions on mt4?

  1. #1

    Is it possible to close all positions on mt4?

    Something like script or ea...

  2. #2
    Quote Originally Posted by ;
    Here is my CloseAll script (Model 2.01 - 22-July-2011) // Establish the optoin prameter to the type of clsoing you need: // 0- Close all (instant and pending orders) (Default) // 1- Close all instant orders // 2- Close all pending orders // 3- Close from the magical number // 4- Close by remark // 5- Close orders in profit // 6- Close orders in loss // 7- Close not today orders // 8- Close before day orders file
    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

  3. #3
    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 .

  4. #4
    Quote Originally Posted by ;
    As far as I know, there's absolutely no such thing as instantaneous shutting on Meta 4. The script or EA will put all trades into a que and execute them in their turn. The orders will probably get closed but not instantly and it might be that all open positions closed, you might have partial profit or even a l 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,

  5. #5
    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

  6. #6
    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

  7. #7
    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

  8. #8
    Inserted Code if (TimeCurrent() - OrderOpenTime() gt;= (TradesWillExpireMins*60) OrderMagicNumber()==MagicNumber)
    Why do you possess the {} in there. Removing them may help

  9. #9
    Quote Originally Posted by ;
    if (TimeCurrent() - OrderOpenTime() gt;= (TradesWillExpireMins*60) OrderMagicNumber()==MagicNumber) why is it that you have the {} in there. Eliminating them may help
    thanks Gumrai, that functioned, appreciate your quick response.

  10. #10
    Quote Originally Posted by ;
    the Top 1 simply double Click the script If u wanT Shut file file
    thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners. Read more.