Opening Too Many Positions

thread: Opening Too Many Positions

  1. #1
    Junior Member Tessita_28's Avatar
    14

    Opening Too Many Positions

    This is pseudocode.

    When the conditions are satisfied in the if statement too many positions have been opened. I only want one place to open even if the illness keeps being true.

    What should I do?

    Int start()

    if (! ExistPositions())

    if (BUY)
    OpenBuy();
    return(0);


    if (SELL)
    OpenSell();
    return(0);




    return (0);

  2. #2
    Inserted Code int Allowed_Orders = 10; int Begin() if (My_Orders() lt; Allowed_Orders) ....your BUY SELL Directions here ....rest of your code goes here return(0); //end of start() //--------------------------------------------- int My_Orders() int Order_Count = 0; for(int I=0;I lt; OrdersTotal();I ) if(OrderSelect(I, SELECT_BY_POS,MODE_TRADES)) if (OrderMagicNumber() == MagicNumber)Order_Count return(Order_Count);

  3. #3
    Junior Member Tessita_28's Avatar
    14
    [code]
    int Allowed_Orders = 10;

    int Begin()
    {...
    Thx, However what Is MagicNumber?

  4. #4
    Junior Member Isacipk00's Avatar
    18
    The number is the number you use when opening your order. The ea may then use this as an identifier.

    For more info check:
    http://docs.mql4.com/trading/OrderSend

  •