Forex Community Place

Dapatkan hingga
$50000
karena mengundang teman
untuk memperoleh Bonus StartUp
dari InstaForex
Tidak perlu investasi!
Mulai trading tanpa
risiko dan investasi
Dengan Bonus Permulaan 1000$
Dapatkan bonus
55%
ke akun anda!
Page 3 of 3
FirstFirst 1 2 3
Results 21 to 28 of 28

Thread: request buatin script sell limit otomatis pasang buy stop sesuwai distance

  1. #21
    Forum Veteran
    ----
     
    reinji has a spectacular aura about reinji has a spectacular aura about reinji has a spectacular aura about reinji's Avatar
    Join Date
    Aug 2010
    Posts
    5,583
    Accumulated bonus
    1395 USD (What is this?)
    Thanks
    78
    Thanked 255 Times in 216 Posts
    Black Frame Talent: Kontes Demotivator pada Forum MT5.com
    Quote Originally Posted by inLuk View Post
    punya ane cuma satu script gan, tinggal pilih aja


    contoh entry: 1, yg pakai pip, 2 yg pakai harga
    Spoiler Spoiler:

    ini yg pakai pip


    ini yg pakai harga



    inputan
    Spoiler Spoiler:




    catatan lain
    Spoiler Spoiler:


    Code:
    //+------------------------------------------------------------------+
    //|                                           INDO_PENDING_ORDER.mq4 |
    //|                                                            inLuk |
    //|            https://www.mql5.com/en/users/indral8/seller#products |
    //+------------------------------------------------------------------+
    #property copyright "inLuk"
    #property link      "https://www.mql5.com/en/users/indral8/seller#products"
    #property version   "1.00"
    #property strict
    #property show_inputs
    //+------------------------------------------------------------------+
    input double _DIST_PRICE=30;//JARAK PIP DARI HARGA, KOSONGKAN JIKA MAU PAKAI PRICE
    input double _SL=30;//SL
    input double _TP=30;//TP
    input int _MAGIC=999;//MAGIC NUMBER
    input ENUM_ORDER_TYPE _ORDER=OP_BUYLIMIT;//PILIH ORDER
    input double _LOT=0.01;//LOT SIZE
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //set variable
       bool send;
       double TP,SL,Harga;
    //kalkulasi digit
       checkDigit(Symbol());
    //pakai distance (pip)
       if(StringFind(string(_DIST_PRICE),".",0)==-1)
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
            }
         }
    //---
       else
         {
          Harga=NormalizeDouble(_DIST_PRICE,_D);
          SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
          TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
          send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,string(_ORDER),_MAGIC,0,clrLime);
          if(!send) Print(GetLastError());
         }
      }
    //+------------------------------------------------------------------+
    int _D,_DIG;
    double _PT;
    //+------------------------------------------------------------------+
    void checkDigit(string sym)
      {
       _D=int(MarketInfo(sym,MODE_DIGITS));
       if(_D==2) { _DIG=10; }//xauusd
       if(_D==3) { _DIG=100; }
       if(_D==4) { _DIG=1000; }
       if(_D==5) { _DIG=10000; }
       _PT=MarketInfo(sym,MODE_POINT);
       if(_D==3 || _D==5) { _PT=10*MarketInfo(sym,MODE_POINT); }
      }
    //+------------------------------------------------------------------+
    jangan lupa thanks nya
    maap gan, makasih sebelumnya, tetap saya pengennya yang mbuy limid di lock dngan sell stop, jadi bisa lockking nanti bisa saya urus lagi tuh locking, klo ini kan cuman mbuy limid kasih sl, tapi makasih dah berkunjung, munkin ada yang bisa perbaiki tuh script punya gan card17, mohon bantuannya

  2. The Following 2 Users Say Thank You to reinji For This Useful Post:


  3. lamborghini
  4. #22
    Orang Lama
    Mengintai
     
    inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk's Avatar
    Join Date
    Apr 2017
    Location
    Indonesia
    Posts
    1,098
    Accumulated bonus
    1545 USD (What is this?)
    Thanks
    1,132
    Thanked 1,516 Times in 594 Posts
    Quote Originally Posted by reinji View Post
    maap gan, makasih sebelumnya, tetap saya pengennya yang mbuy limid di lock dngan sell stop, jadi bisa lockking nanti bisa saya urus lagi tuh locking, klo ini kan cuman mbuy limid kasih sl, tapi makasih dah berkunjung, munkin ada yang bisa perbaiki tuh script punya gan card17, mohon bantuannya
    gampang ini, jadi intinya 2 entry di satu harga gitu kan ? di tambah distance antar PO nya semisal 3 pip (normal spread)

    ---------- Post added at 11:12 AM ---------- Previous post was at 10:55 AM ----------

    Jangan lupa thansk nya
    Spoiler Spoiler:


    Code:
    //+------------------------------------------------------------------+
    //|                                           INDO_PENDING_ORDER.mq4 |
    //|                                                            inLuk |
    //|            https://www.mql5.com/en/users/indral8/seller#products |
    //+------------------------------------------------------------------+
    #property copyright "inLuk"
    #property link      "https://www.mql5.com/en/users/indral8/seller#products"
    #property version   "1.00"
    #property strict
    #property show_inputs
    //+------------------------------------------------------------------+
    input double _DIST_PRICE=30;//JARAK PIP DARI HARGA, KOSONGKAN JIKA MAU PAKAI PRICE
    input double _SL=30;//SL
    input double _TP=30;//TP
    input int _MAGIC=999;//MAGIC NUMBER
    input ENUM_ORDER_TYPE _ORDER=OP_BUYLIMIT;//PILIH ORDER
    input double _LOT=0.01;//LOT SIZE
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //set variable
       bool send;
       double TP,SL,Harga;
    //kalkulasi digit
       checkDigit(Symbol());
    //pakai distance (pip)
       if(StringFind(string(_DIST_PRICE),".",0)==-1)
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(Ask-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Ask-_DIST_PRICE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(Ask+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Ask+_DIST_PRICE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
    //--- harga pasti
       else
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(_DIST_PRICE-MarketInfo(NULL,MODE_SPREAD)*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(_DIST_PRICE+MarketInfo(NULL,MODE_SPREAD)*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(_DIST_PRICE-MarketInfo(NULL,MODE_SPREAD)*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(_DIST_PRICE+MarketInfo(NULL,MODE_SPREAD)*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
      }
    //+------------------------------------------------------------------+
    int _D,_DIG;
    double _PT;
    //+------------------------------------------------------------------+
    void checkDigit(string sym)
      {
       _D=int(MarketInfo(sym,MODE_DIGITS));
       if(_D==2) { _DIG=10; }//xauusd
       if(_D==3) { _DIG=100; }
       if(_D==4) { _DIG=1000; }
       if(_D==5) { _DIG=10000; }
       _PT=MarketInfo(sym,MODE_POINT);
       if(_D==3 || _D==5) { _PT=10*MarketInfo(sym,MODE_POINT); }
      }
    //+------------------------------------------------------------------+

  5. The Following User Says Thank You to inLuk For This Useful Post:

    reinji (08-02-2017)

  6. #23
    Forum Veteran
    ----
     
    reinji has a spectacular aura about reinji has a spectacular aura about reinji has a spectacular aura about reinji's Avatar
    Join Date
    Aug 2010
    Posts
    5,583
    Accumulated bonus
    1395 USD (What is this?)
    Thanks
    78
    Thanked 255 Times in 216 Posts
    Black Frame Talent: Kontes Demotivator pada Forum MT5.com
    Quote Originally Posted by inLuk View Post
    gampang ini, jadi intinya 2 entry di satu harga gitu kan ? di tambah distance antar PO nya semisal 3 pip (normal spread)

    ---------- Post added at 11:12 AM ---------- Previous post was at 10:55 AM ----------

    Jangan lupa thansk nya
    Spoiler Spoiler:


    Code:
    //+------------------------------------------------------------------+
    //|                                           INDO_PENDING_ORDER.mq4 |
    //|                                                            inLuk |
    //|            https://www.mql5.com/en/users/indral8/seller#products |
    //+------------------------------------------------------------------+
    #property copyright "inLuk"
    #property link      "https://www.mql5.com/en/users/indral8/seller#products"
    #property version   "1.00"
    #property strict
    #property show_inputs
    //+------------------------------------------------------------------+
    input double _DIST_PRICE=30;//JARAK PIP DARI HARGA, KOSONGKAN JIKA MAU PAKAI PRICE
    input double _SL=30;//SL
    input double _TP=30;//TP
    input int _MAGIC=999;//MAGIC NUMBER
    input ENUM_ORDER_TYPE _ORDER=OP_BUYLIMIT;//PILIH ORDER
    input double _LOT=0.01;//LOT SIZE
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //set variable
       bool send;
       double TP,SL,Harga;
    //kalkulasi digit
       checkDigit(Symbol());
    //pakai distance (pip)
       if(StringFind(string(_DIST_PRICE),".",0)==-1)
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(Ask-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Ask-_DIST_PRICE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(Ask+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Ask+_DIST_PRICE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
    //--- harga pasti
       else
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(_DIST_PRICE-MarketInfo(NULL,MODE_SPREAD)*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(_DIST_PRICE+MarketInfo(NULL,MODE_SPREAD)*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(_DIST_PRICE-MarketInfo(NULL,MODE_SPREAD)*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(_DIST_PRICE+MarketInfo(NULL,MODE_SPREAD)*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
      }
    //+------------------------------------------------------------------+
    int _D,_DIG;
    double _PT;
    //+------------------------------------------------------------------+
    void checkDigit(string sym)
      {
       _D=int(MarketInfo(sym,MODE_DIGITS));
       if(_D==2) { _DIG=10; }//xauusd
       if(_D==3) { _DIG=100; }
       if(_D==4) { _DIG=1000; }
       if(_D==5) { _DIG=10000; }
       _PT=MarketInfo(sym,MODE_POINT);
       if(_D==3 || _D==5) { _PT=10*MarketInfo(sym,MODE_POINT); }
      }
    //+------------------------------------------------------------------+
    kok gak masukkin harga sih gan, pengen saya gini
    1. saya pengen pending order mbuy limit, saya akan masukkin harga sesuai kehendak saya, contoh di 1.900
    2. di situ juga masukkin distance, jadi misal saya isi distance 30, maka sotomatis itu scrip pasang sell melilid di 1.870

    begitu sebalikknya jika pasang sell melilid

  7. #24
    Orang Lama
    Mengintai
     
    inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk's Avatar
    Join Date
    Apr 2017
    Location
    Indonesia
    Posts
    1,098
    Accumulated bonus
    1545 USD (What is this?)
    Thanks
    1,132
    Thanked 1,516 Times in 594 Posts
    Quote Originally Posted by reinji View Post
    kok gak masukkin harga sih gan, pengen saya gini
    1. saya pengen pending order mbuy limit, saya akan masukkin harga sesuai kehendak saya, contoh di 1.900
    2. di situ juga masukkin distance, jadi misal saya isi distance 30, maka sotomatis itu scrip pasang sell melilid di 1.870

    begitu sebalikknya jika pasang sell melilid
    oh gitu wkwkk besok deh ku update

    ---------- Post added at 08:21 PM ---------- Previous post was at 08:20 PM ----------

    tapi d inputan distance itu bisa by harga juga .. tinggal distance ke PO ke dua aja yg belum ku kasi

  8. The Following User Says Thank You to inLuk For This Useful Post:

    reinji (08-03-2017)

  9. #25
    Orang Lama
    Mengintai
     
    inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk's Avatar
    Join Date
    Apr 2017
    Location
    Indonesia
    Posts
    1,098
    Accumulated bonus
    1545 USD (What is this?)
    Thanks
    1,132
    Thanked 1,516 Times in 594 Posts
    Here you go ...


    catatan: untuk inputan yg saya tandai merah, itu bisa di isi dengan nilai PIP (4 digit) ataupun harga yg di maksud (1.2345)

    Code:
    //+------------------------------------------------------------------+
    //|                                           INDO_PENDING_ORDER.mq4 |
    //|                                                            inLuk |
    //|            https://www.mql5.com/en/users/indral8/seller#products |
    //+------------------------------------------------------------------+
    #property copyright "inLuk"
    #property link      "https://www.mql5.com/en/users/indral8/seller#products"
    #property version   "1.00"
    #property strict
    #property show_inputs
    //+------------------------------------------------------------------+
    input double _DIST_PRICE=30;//JARAK PIP DARI HARGA SAAT INI ATAU PAKAI HARGA (1.2345)
    input double _SPACE=3;//JARAK PIP KE PO KEDUA
    input double _SL=30;//SL
    input double _TP=30;//TP
    input int _MAGIC=999;//MAGIC NUMBER
    input ENUM_ORDER_TYPE _ORDER=OP_BUYLIMIT;//PILIH ORDER
    input double _LOT=0.01;//LOT SIZE
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //set variable
       bool send;
       double TP,SL,Harga;
    //kalkulasi digit
       checkDigit(Symbol());
    //pakai distance (pip)
       if(StringFind(string(_DIST_PRICE),".",0)==-1)
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(Ask-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(Ask+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
    //--- harga pasti
       else
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
      }
    //+------------------------------------------------------------------+
    int _D,_DIG;
    double _PT;
    //+------------------------------------------------------------------+
    void checkDigit(string sym)
      {
       _D=int(MarketInfo(sym,MODE_DIGITS));
       if(_D==2) { _DIG=10; }//xauusd
       if(_D==3) { _DIG=100; }
       if(_D==4) { _DIG=1000; }
       if(_D==5) { _DIG=10000; }
       _PT=MarketInfo(sym,MODE_POINT);
       if(_D==3 || _D==5) { _PT=10*MarketInfo(sym,MODE_POINT); }
      }
    //+------------------------------------------------------------------+


    ---------- Post added at 07:47 AM ---------- Previous post was at 06:59 AM ----------

    contoh inputan pakai harga
    Spoiler Spoiler:

    inputannya
    Spoiler Spoiler:


    hasilnya
    Spoiler Spoiler:



    contoh inputan pakai pip
    Spoiler Spoiler:

    inputan
    Spoiler Spoiler:

    hasil
    Spoiler Spoiler:


  10. The Following 2 Users Say Thank You to inLuk For This Useful Post:

    jlitenk (09-05-2017), reinji (08-03-2017)

  11. #26
    Forum Veteran
    ----
     
    reinji has a spectacular aura about reinji has a spectacular aura about reinji has a spectacular aura about reinji's Avatar
    Join Date
    Aug 2010
    Posts
    5,583
    Accumulated bonus
    1395 USD (What is this?)
    Thanks
    78
    Thanked 255 Times in 216 Posts
    Black Frame Talent: Kontes Demotivator pada Forum MT5.com
    Quote Originally Posted by inLuk View Post
    Here you go ...


    catatan: untuk inputan yg saya tandai merah, itu bisa di isi dengan nilai PIP (4 digit) ataupun harga yg di maksud (1.2345)

    Code:
    //+------------------------------------------------------------------+
    //|                                           INDO_PENDING_ORDER.mq4 |
    //|                                                            inLuk |
    //|            https://www.mql5.com/en/users/indral8/seller#products |
    //+------------------------------------------------------------------+
    #property copyright "inLuk"
    #property link      "https://www.mql5.com/en/users/indral8/seller#products"
    #property version   "1.00"
    #property strict
    #property show_inputs
    //+------------------------------------------------------------------+
    input double _DIST_PRICE=30;//JARAK PIP DARI HARGA SAAT INI ATAU PAKAI HARGA (1.2345)
    input double _SPACE=3;//JARAK PIP KE PO KEDUA
    input double _SL=30;//SL
    input double _TP=30;//TP
    input int _MAGIC=999;//MAGIC NUMBER
    input ENUM_ORDER_TYPE _ORDER=OP_BUYLIMIT;//PILIH ORDER
    input double _LOT=0.01;//LOT SIZE
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //set variable
       bool send;
       double TP,SL,Harga;
    //kalkulasi digit
       checkDigit(Symbol());
    //pakai distance (pip)
       if(StringFind(string(_DIST_PRICE),".",0)==-1)
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(Ask-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(Ask+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
    //--- harga pasti
       else
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
      }
    //+------------------------------------------------------------------+
    int _D,_DIG;
    double _PT;
    //+------------------------------------------------------------------+
    void checkDigit(string sym)
      {
       _D=int(MarketInfo(sym,MODE_DIGITS));
       if(_D==2) { _DIG=10; }//xauusd
       if(_D==3) { _DIG=100; }
       if(_D==4) { _DIG=1000; }
       if(_D==5) { _DIG=10000; }
       _PT=MarketInfo(sym,MODE_POINT);
       if(_D==3 || _D==5) { _PT=10*MarketInfo(sym,MODE_POINT); }
      }
    //+------------------------------------------------------------------+


    ---------- Post added at 07:47 AM ---------- Previous post was at 06:59 AM ----------

    contoh inputan pakai harga
    Spoiler Spoiler:

    inputannya
    Spoiler Spoiler:


    hasilnya
    Spoiler Spoiler:



    contoh inputan pakai pip
    Spoiler Spoiler:

    inputan
    Spoiler Spoiler:

    hasil
    Spoiler Spoiler:

    waah, makasih mastah koding masih setanbe di sini, ane coba dulugan, maap merepotkan, hehehe nanti silahkan ke tret an yang sebelah sekalian untuk jebak NPF, hehehe

  12. #27
    Orang Lama
    Mengintai
     
    inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk has much to be proud of inLuk's Avatar
    Join Date
    Apr 2017
    Location
    Indonesia
    Posts
    1,098
    Accumulated bonus
    1545 USD (What is this?)
    Thanks
    1,132
    Thanked 1,516 Times in 594 Posts
    Quote Originally Posted by reinji View Post
    waah, makasih mastah koding masih setanbe di sini, ane coba dulugan, maap merepotkan, hehehe nanti silahkan ke tret an yang sebelah sekalian untuk jebak NPF, hehehe
    wah trit yg mana nih, dan saya masih belajar aja kok tentang coding xiixii

  13. <a href="https://www.mt5.com/id/">Forex Portal MT5</a>
  14. #28
    Pecandu
    Bahagia
     
    jlitenk is on a distinguished road jlitenk's Avatar
    Join Date
    Jan 2011
    Location
    batam
    Posts
    591
    Accumulated bonus
    112 USD (What is this?)
    Thanks
    49
    Thanked 26 Times in 23 Posts
    Quote Originally Posted by inLuk View Post
    Here you go ...


    catatan: untuk inputan yg saya tandai merah, itu bisa di isi dengan nilai PIP (4 digit) ataupun harga yg di maksud (1.2345)

    Code:
    //+------------------------------------------------------------------+
    //|                                           INDO_PENDING_ORDER.mq4 |
    //|                                                            inLuk |
    //|            https://www.mql5.com/en/users/indral8/seller#products |
    //+------------------------------------------------------------------+
    #property copyright "inLuk"
    #property link      "https://www.mql5.com/en/users/indral8/seller#products"
    #property version   "1.00"
    #property strict
    #property show_inputs
    //+------------------------------------------------------------------+
    input double _DIST_PRICE=30;//JARAK PIP DARI HARGA SAAT INI ATAU PAKAI HARGA (1.2345)
    input double _SPACE=3;//JARAK PIP KE PO KEDUA
    input double _SL=30;//SL
    input double _TP=30;//TP
    input int _MAGIC=999;//MAGIC NUMBER
    input ENUM_ORDER_TYPE _ORDER=OP_BUYLIMIT;//PILIH ORDER
    input double _LOT=0.01;//LOT SIZE
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //set variable
       bool send;
       double TP,SL,Harga;
    //kalkulasi digit
       checkDigit(Symbol());
    //pakai distance (pip)
       if(StringFind(string(_DIST_PRICE),".",0)==-1)
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(Ask-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(Bid-_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(Ask+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(Bid+_DIST_PRICE*_PT,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
    //--- harga pasti
       else
         {
          if(_ORDER==OP_BUYLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLSTOP,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLSTOP",_MAGIC,0,clrRed);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYLIMIT,_LOT,Harga,0,SL,TP,"OP_BUYLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_BUYSTOP)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga-_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_SELLLIMIT,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
          if(_ORDER==OP_SELLLIMIT)
            {
             Harga=NormalizeDouble(_DIST_PRICE,_D);
             SL=(_SL>0)?NormalizeDouble(Harga+_SL*_PT,_D):0;
             TP=(_TP>0)?NormalizeDouble(Harga-_TP*_PT,_D):0;
             send=OrderSend(Symbol(),_ORDER,_LOT,Harga,0,SL,TP,"OP_SELLLIMIT",_MAGIC,0,clrBlue);
             if(!send) Print(GetLastError());
             else
               {
                Harga=NormalizeDouble(Harga+_SPACE*_PT,_D);
                SL=(_SL>0)?NormalizeDouble(Harga-_SL*_PT,_D):0;
                TP=(_TP>0)?NormalizeDouble(Harga+_TP*_PT,_D):0;
                send=OrderSend(Symbol(),OP_BUYSTOP,_LOT,Harga,0,SL,TP,"OP_BUYSTOP",_MAGIC,0,clrBlue);
                if(!send) Print(GetLastError());
               }
            }
         }
      }
    //+------------------------------------------------------------------+
    int _D,_DIG;
    double _PT;
    //+------------------------------------------------------------------+
    void checkDigit(string sym)
      {
       _D=int(MarketInfo(sym,MODE_DIGITS));
       if(_D==2) { _DIG=10; }//xauusd
       if(_D==3) { _DIG=100; }
       if(_D==4) { _DIG=1000; }
       if(_D==5) { _DIG=10000; }
       _PT=MarketInfo(sym,MODE_POINT);
       if(_D==3 || _D==5) { _PT=10*MarketInfo(sym,MODE_POINT); }
      }
    //+------------------------------------------------------------------+


    ---------- Post added at 07:47 AM ---------- Previous post was at 06:59 AM ----------

    contoh inputan pakai harga
    Spoiler Spoiler:

    inputannya
    Spoiler Spoiler:


    hasilnya
    Spoiler Spoiler:



    contoh inputan pakai pip
    Spoiler Spoiler:

    inputan
    Spoiler Spoiler:

    hasil
    Spoiler Spoiler:

    OM INLUK, boleh request di tambahkan jumlah ordernya, misal pengen order limitnya 5, 10 dan seterusnya... tq
    kalo demo terus, kapan WD-nya.....

Page 3 of 3
FirstFirst 1 2 3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts