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

mohon koreksinya masalah -1 error 129 (infalid price)

Discussion in 'Belajar MQL dari Nol' started by Aris pamuji, 23 Nov 2018.

  1. Aris pamuji

    Aris pamuji New Member

    Equity
    Credit
    Ref Point
    //+------------------------------------------------------------------+
    //| asyaf2.mq4 |
    //| Copyright 2018, MetaQuotes Software Corp. |
    //| https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2018, MetaQuotes Software Corp."
    #property link "https://www.mql5.com"
    #property version "1.00"
    #property strict


    //--- input parameters
    input int FastMA= 8;
    input int SlowMA= 55;
    input double Lots= 0.02;
    input ENUM_MA_METHOD MA_methode = 0;
    input ENUM_APPLIED_PRICE MA_Price = 0;

    //fungition nilai MA fast
    double pMA_f (int shift){
    double result = 0;
    result = iMA(Symbol(),0,FastMA,0,MA_methode,MA_Price,shift);
    return(result);}

    // nilai MA slow
    double pMA_s (int shift){
    double result = 0;
    result = iMA(Symbol(),0,SlowMA,0,MA_methode,MA_Price,shift);
    return(result);}

    //fungsi open order
    void AsfOrder(int cmd){
    int Tiket = OrderSend(Symbol(),cmd,Lots,0,0,0,0,"asyaf order");
    }




    //+------------------------------------------------------------------+
    //| Expert initialization function |
    //+------------------------------------------------------------------+
    int OnInit()
    {
    //---
    Alert ("Selamat Datang Di EA by Asyaf57");
    //---
    return(INIT_SUCCEEDED);
    }
    //+------------------------------------------------------------------+
    //| Expert deinitialization function |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
    {
    //---

    }
    //+------------------------------------------------------------------+
    //| Expert tick function |
    //+------------------------------------------------------------------+
    void OnTick()
    {
    // order buy
    if (pMA_f (1) < pMA_s(1) && pMA_f (0) == pMA_s (0))AsfOrder(OP_BUY);
    if (pMA_f (1) >= pMA_s(1))return;
    if (pMA_f (1) > pMA_s(1) && pMA_f (0) == pMA_s (0))AsfOrder(ORDER_TP);
    }
    //+------------------------------------------------------------------+
     
  2. domain

    domain New Member

    Equity
    Credit
    Ref Point
    0 setelah Lots itu harusnya Ask atau Bid.
    karena OrderPrice.
    contoh
    OrderSend(Symbol(),cmd,Lots,Ask,0,0,0,NULL,MagicNumber,0,clrNONE);}
     

Share This Page