Help code mql4 for my EA
Results 1 to 3 of 33

Thread: Help code mql4 for my EA

  1. #1
    Hi,

    I want your help to get part of my code. I would like to start a new Long trade with 0.02lots once if the price falls about 50 pips, So I want to place ExistPositions0.02lots() FALSE first and place it TRUE when the new order with 0.02lots is opened.
    How can I change this ExistPositions0.02lots() ? )

    Bool ExistPositions0.02lots()
    for (int I=0; ilt;OrdersTotal(); I )
    if (OrderSelect(I, SELECT_BY_POS, MODE_TRADES))
    if (OrderSymbol()==Symbol() OrderLots()==0.02)
    return(True);



    return(False);


    void DoublePositionBuy(int Perte1)
    if (ExistPositions() ! ExistPositions0.02lots())
    for (int I=0; ilt;OrdersTotal(); I )
    if (OrderSelect(I, SELECT_BY_POS, MODE_TRADES))
    if (OrderSymbol()==Symbol())
    if (OrderType()==OP_BUY)
    if (OrderOpenPrice() - Ask gt; Point * Perte1)
    OpenBuyDouble();









    THANKS A LOT.

  2. #2
    I have a solution: I will utilize BuyLimit and SelLimit but is there anyone that tells me how can I close all pending orders WHEN the first transaction is closed?

    Thanks a lot.

  3. #3
    I Discovered this code:

    void DeleteThis_BUYSTOP( int MagicNumber ) {
    bool deleted;
    for (int I = 0; I lt; OrdersTotal(); I )
    OrderSelect(I, SELECT_BY_POS, MODE_TRADES);
    while(IsTradeContextBusy()) Sleep(100);

    if (OrderType() == OP_BUYSTOP MagicNumber == OrderMagicNumber()
    OrderSymbol() == Symbol() ) deleted = OrderDelete(OrderTicket(), CLR_NONE);

    if(deleted == false)

    Print(Error deleting buy stop order OrderTicket() Err#: GetLastError());






    But how Do I use it If a trade of 0.01lot is Shut?

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.