1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)
    Dismiss Notice

I need help

Discussion in 'Belajar MQL dari Nol' started by alan gabriel, 09 Jul 2019.

  1. alan gabriel

    alan gabriel New Member

    Equity
    Credit
    Ref Point
    I need help
    I am wanting to create a function that increases the batch if I close an order with loss.
    Can someone help me ?
     
  2. amtwoxtwo

    amtwoxtwo Member Credit Hunter

    Equity
    Credit
    Ref Point
    check order history.
    Code:
    double profit=0, lot=0;
    int directions=-1;
    for(int i=0; i<OrdersHistoryTotal();i++)
      {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
      {
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
      {
     profit = OrderProfit();
     lot = OrderLots();
    directions = OrderType();
      }
      }
    }
    
    from there, you can see your last order status.
    profit = last order if profit or not
    lot = last order lots
    directions = last order is buy or sell
     
  3. alan gabriel

    alan gabriel New Member

    Equity
    Credit
    Ref Point
    Thank you for your help

    I got it
     
  4. Bahaman

    Bahaman New Member

    Equity
    Credit
    Ref Point
    string pairs[] = { "AUDCAD","AUDJPY","AUDNZD","AUDUSD","CHFJPY","EURAUD","EURCAD","EURCHF","EURGBP","EURJPY","EURUSD","GBPCHF","GBPJPY","GBPUSD","NZDJPY","NZDUSD","USDCAD","USDCHF","USDJPY","GOLD" };

    Bagaiman hendak bagi terdapat dalam Porperties > Inputs / How to find it in Porperties> Inputs
     
  5. amtwoxtwo

    amtwoxtwo Member Credit Hunter

    Equity
    Credit
    Ref Point
    enum pairs{
    AUDCAD = 1,
    AUDJPY = 2,
    AUDNZD = 3,
    AUDUSD = 4,
    CHFJPY = 5,
    EURAUD = 6,
    };
    input pairs yourpair = AUDCAD;
     

Share This Page