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

Question Pembagian Kelas Kursus MQL dari Nol sampai mahir

Discussion in 'Belajar MQL dari Nol' started by SoeHoe, 24 Sep 2021.

Tags:
  1. Tulus

    Tulus New Member

    Equity
    Credit
    Ref Point
    Ijin belajar mql4 dari nol, Pak. Tentang indi MT4, EA dan tranformasi indi mql4 ke mql5 Pak Soehoe. Pernah ikut kursus dari Master Inluk, cuman kagak berhasil membuat eanya Pak.
     
  2. Slamet Hariyadi

    Slamet Hariyadi New Member

    Equity
    Credit
    Ref Point
    Kelanjutannya utk pembagian kelas kemarin gmn ya, apa sdh kebentuk anggotanya . dan kapan pelaksanaan zoom nya?
     
  3. Bloni Simarmata

    Bloni Simarmata New Member

    Equity
    Credit
    Ref Point
    Ijin Pak saya ikut kelas pemula atau tingkat paud ada gak ya? Karena buta kayu sama sekali tentang EA atau mql4 :)
     
  4. Rafael Benny

    Rafael Benny New Member

    Equity
    Credit
    Ref Point
    Code:
    void QnOrderMarti()
      {
    //---
      // Judul Kelas SMP : Membuat EA Martingale
      // Follow Trend : EMA200 (H4), Harga > EMA200 Signal BUY, Harga <EMA200 Signal SELL
      // Trigger: OP Pertama saat garis RSI (M30) berada di area 30/70
      // Martingale : Martingale berdasarkan Range Harian ATR(D1)
     
      double dLot = 0.01, dMultiply = 2;
      double dEma200 = NormalizeDouble(iMA(_Symbol,PERIOD_H4,200,0,MODE_EMA,PRICE_CLOSE,1),Digits);
      double dRsi    = NormalizeDouble(iRSI(_Symbol,PERIOD_M30,14,PRICE_CLOSE,1),Digits);
      double dAtr    = NormalizeDouble(iATR(_Symbol,PERIOD_D1,20,1),Digits);
     
      double dAsk = MarketInfo(_Symbol, MODE_ASK);
      double dBid = MarketInfo(_Symbol, MODE_BID);   
      double dPrcNow = NormalizeDouble((dAsk+dBid)/2,Digits);
      int iSignal=0, i;
      double dPrc = 0;
      double dProfit=0, dTargetP=7;  // target tiap OP $7
       
      // Close All bila Total Profit tercapai
      if (dTargetP  > 0) {
        dTargetP=dTargetP*(OrdersTotal());
        for(i=0;i<=OrdersTotal()-1;i++) {   
         OrderSelect(i, SELECT_BY_POS);
         dProfit += NormalizeDouble(OrderProfit()+OrderSwap()+OrderCommission(),Digits);
       }   
       if (dProfit >= dTargetP) {
         for(i=OrdersTotal()-1;i>=0;i--) {
          OrderSelect(i, SELECT_BY_POS);             
          if(OrderType()==OP_BUY)  OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 0, clrRed);
          if(OrderType()==OP_SELL) OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 0, clrRed);
         } 
        }   
      }     
       
    
      // New Entry
      if (dPrcNow>dEma200 && dRsi<=30) iSignal=1;          //1-BUY     2-SELL
      else if (dPrcNow<dEma200 && dRsi>=70) iSignal=2;
      // Martingale bila sudah ada OP Pertama
      if (OrdersTotal()!=0) {
        iSignal=0;
        i = OrdersTotal()-1;
        OrderSelect(i, SELECT_BY_POS);
        dPrc = NormalizeDouble(OrderOpenPrice(),Digits);
        dLot = OrderLots()*dMultiply;
        if (OrderType()==OP_BUY && dPrcNow<dPrc-dAtr) iSignal=1;
        else if (OrderType()==OP_SELL && dPrcNow>dPrc+dAtr) iSignal=2;
      }
    
      if (iSignal==1) OrderSend(_Symbol,OP_BUY,dLot,Ask,0,0,0,"EA Martingale",0,0,0);
      else if (iSignal==2) OrderSend(_Symbol,OP_SELL,dLot,Bid,0,0,0,"EA Martingale",0,0,0);   
       
      }
     
  5. ahmadmunawir_79

    ahmadmunawir_79 New Member

    Equity
    Credit
    Ref Point
    Ijin gabung belajar MQL dari nol alias PAUD basic saya ilmu arsitek dan engginer..jd ijinmasuk kelas PAUD krn masih buta ini...
     
  6. Recky

    Recky New Member

    Equity
    Credit
    Ref Point
    Mohon infonya jika sudah ada pembagian kelas dalam forum ini :)
     
  7. skylin3

    skylin3 New Member

    Equity
    Credit
    Ref Point
    Mohon Koreksi master SoeHoe untuk tugas Kelas SMP :

    Code:
    //+------------------------------------------------------------------+
    //|                                                Belajar_Marti.mq4 |
    //|                        Copyright 2021, MetaQuotes Software Corp. |
    //|                                             https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright@Skylin3 2021, MetaQuotes Software Corp."
    #property link      "https://www.mql5.com"
    #property version   "1.00"
    #property strict
    //+------------------------------------------------------------------+
    //| Expert initialization function                                   |
    //+------------------------------------------------------------------+
    input double StartLots             = 0.01;
    input double Multiply              = 2;
    input double PipStep               = 300;
    input int    Max_Order             = 10;
    input double TP                    = 300;
    input double SL                    = 300;
    input int    Slip                  = 3;
    input int    MagicNumber           = 1234;
    
    int Tick;
    datetime lastopendate;
    
    
    
    int OnInit()
      {
    //---
       
    //---
       return(INIT_SUCCEEDED);
      }
    //+------------------------------------------------------------------+
    //| Expert deinitialization function                                 |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
      {
    //---
     
       
      }
    //+------------------------------------------------------------------+
    //| Expert tick function                                             |
    //+------------------------------------------------------------------+
    void OnTick()
      {
       if(TotalOrder()==0){
          if(TodayCloseOrderCount(OP_BUY)==0){
                if(Signal()==0&&TotalOP()==0)
                   OrderSend(Symbol(),OP_BUY,StartLots,Ask,3,0,0,"",MagicNumber,0,clrBlue);
                             
                   if(TotalOP()>0)
                      OpenPO(LastOpenPrice(),OP_BUY);
             }
         
            if(TodayCloseOrderCount(OP_SELL)==0){
               if(Signal()==1&&TotalOP()==0)
               OrderSend(Symbol(),OP_SELL,StartLots,Bid,3,0,0,"",MagicNumber,0,clrRed);
                     
              if(TotalOP()>0){
                OpenPO(LastOpenPrice(),OP_SELL);
             }
          }
       
      }
       
       if(TotalOP()>0&&TotalOP()<=Max_Order)
          ModifTp();
       
       if(TotalOP()==Max_Order)
          SetSL();
         
       if(TotalOP()==0&&(OrderTypeCount(OP_BUYLIMIT)>0||OrderTypeCount(OP_SELLLIMIT)>0))
          DeletePendingOrder();
         
         
      }
    
    
    int TotalOrder(){
          int total=0;
       
          for(int i=0;i<OrdersTotal();i++){
             OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
                if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
                   total++;
               
                }
               
                return total;
               
            }
    
    int TotalOP(){
          int total=0;
       
          for(int i=0;i<OrdersTotal();i++){
             OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
                if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&OrderType()<=OP_SELL)
                   total++;
                      }
               
                return total;
               
            }
    
    void OpenPO(double Layerprice, int tipe_op){
    
     
         for(int i=0;i<Max_Order;i++){
             double last_lot   = NormalizeDouble(StartLots*MathPow(Multiply,TotalOrder()),2);
       
       
             if(tipe_op==OP_BUY){
                   int res  = OrderSend(Symbol(),OP_BUYLIMIT,last_lot,Layerprice,3,0,0,"",MagicNumber,0,clrNONE);
                   Layerprice = Layerprice-(PipStep*MarketInfo(Symbol(),MODE_POINT));
         
          }
         
         if(tipe_op==OP_SELL){
                   int res  = OrderSend(Symbol(),OP_SELLLIMIT,last_lot,Layerprice,3,0,0,"",MagicNumber,0,clrNONE);
                   Layerprice = Layerprice+(PipStep*MarketInfo(Symbol(),MODE_POINT));
         
          }
          }
          }
    
    int Signal(){
    
    double LastHi = iHigh(Symbol(),PERIOD_D1,1);
    double LastLo = iLow(Symbol(),PERIOD_D1,1);
    
    int sinyal=-1;
    
    if(Bid<LastLo)
       sinyal=0;
    
    if(Bid>LastHi)
       sinyal=1;
       
       return sinyal;
    
    }
    
    int TodayCloseOrderCount(int typeorder){
    
    int count_order=0;
    if(OrdersHistoryTotal()>0){
          for(int i=OrdersHistoryTotal()-1;i>=0; i--){
    
             OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
               
           
             if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&(OrderType()==typeorder)&&iBarShift(Symbol(),PERIOD_D1,OrderCloseTime())==0){
                count_order++;
                break;
                  }
                 
          }
           
       }
    
       return count_order;
    }
    
    
    
    int OrderTypeCount(int type){
    
    int count=0;
    for(int i=0;i<OrdersTotal();i++){
    
       OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         
          if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&OrderType()==type)
             count++;
             
       }   
        return count;
       
    }
    
    
    double LastOpenPrice(){
    
    double price=0;
    datetime opentime=0;
    
    if(TotalOrder()>0){
       for(int a=OrdersTotal()-1;a>=0;a--){
                if(!OrderSelect(a,SELECT_BY_POS,MODE_TRADES))
                   continue;
                   
                   if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&(OrderType()==OP_BUY||OrderType()==OP_SELL)){
                     
                                       
                      if(OrderOpenTime()>opentime){
                         opentime = OrderOpenTime();
                         price = OrderOpenPrice();
                         lastopendate = OrderOpenTime();
                         }
                         
                         
                    }
                }
               
             }
             
      else if(TotalOrder()==0){
       if(OrdersHistoryTotal()>0){
      for(int x=OrdersHistoryTotal()-1;x>=0;x--){
          if(!OrderSelect(x,SELECT_BY_POS,MODE_HISTORY))
             continue;
             
          if(Symbol()==OrderSymbol()&&OrderMagicNumber()==MagicNumber&&(OrderType()==OP_BUY||OrderType()==OP_SELL)){
             if(OrderOpenTime()>opentime){
                opentime = OrderOpenTime();
                price = OrderOpenPrice();
                lastopendate = OrderOpenTime();
                      }
         
         
                   }
     
     
                }
             }
      } 
             return price;
       }
       
    void SetSL(){
       
    double sl_buy,sl_sell;
    double sl_op=0;
    int op_ct=0;
       
    sl_buy = NormalizeDouble(LastOpenPrice()-SL*Point,Digits);
    sl_sell = NormalizeDouble(LastOpenPrice()+SL*Point,Digits);
                   
                   
       for(int c=0;c<OrdersTotal();c++){
          if(!OrderSelect(c,SELECT_BY_POS,MODE_TRADES))
             continue;
             
             if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&OrderType()<=OP_SELL){
           
                if(OrderType()==OP_BUY){
               
                      if(OrderStopLoss()==0.0||OrderStopLoss()!=sl_buy){
                                       
                                      if(!OrderModify(OrderTicket(),OrderOpenPrice(),sl_buy,OrderTakeProfit(),0,Green))
                                        Print("OrderModify error ",GetLastError());
                                       
                                        }
                           }
               
                   if(OrderType()==OP_SELL){
                     
                      if(OrderStopLoss()==0.0||OrderStopLoss()!=sl_sell){
         
                                      if(!OrderModify(OrderTicket(),OrderOpenPrice(),sl_sell,OrderTakeProfit(),0,Green))
                                        Print("OrderModify error ",GetLastError());
                           
                               }
                           }
                  }
    
          }
    
    }
    
    
    
    
    void ModifTp(){
    
    double tp_buy,tp_sell;
                     
    tp_buy = NormalizeDouble(LastOpenPrice()+TP*Point,Digits);
    tp_sell = NormalizeDouble(LastOpenPrice()-TP*Point,Digits);
                       
                     
    
       for(int i=OrdersTotal()-1;i>=0;i--){
          if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
               if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&(OrderType()<=OP_SELL)){
                 
                             
                   if(OrderType()==OP_BUY){
                       if(OrderTakeProfit()==0||OrderTakeProfit()!=tp_buy){               
                             if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),tp_buy,0,Green))
                                        Print("OrderModify error "+IntegerToString(OrderTicket()),GetLastError());
                   
                                  }
                                       
                           }
                 
                       
                     
                   if(OrderType()==OP_SELL){
                     
                                     
                      if(OrderTakeProfit()==0||OrderTakeProfit()!=tp_sell){               
                              if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),tp_sell,0,Green))
                                        Print("OrderModify error "+IntegerToString(OrderTicket()),GetLastError());
                   
                                }
                 
                           }
                     
                  }
    
          }
    
    }
    
    
    
    void DeletePendingOrder(){
    
    for(int i=OrdersTotal()-1;i>=0;i--){
       OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
       
       if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber){
          if(OrderType()==OP_BUYLIMIT||OrderType()==OP_BUYSTOP||OrderType()==OP_SELLLIMIT||OrderType()==OP_SELLSTOP)
               bool res = OrderDelete(OrderTicket(),clrNONE);
             }
       }
    }
     
  8. ananasrofi

    ananasrofi New Member

    Equity
    Credit
    Ref Point
    Ijin belajar paak
    Kelas SMP
     
  9. Nur Indra

    Nur Indra New Member

    Equity
    Credit
    Ref Point
    Saya ingin belajar MQL mulai dari nol. Selama ini sudah biasa menggunakan excel, cuma kalau utk MQL belum pernah sama sekali.
    Mohon bimbingannya.
    Terima kasih.
     
  10. kangnana

    kangnana New Member

    Equity
    Credit
    Ref Point
    5/5,
    This is my review for this thread:
    Ijin gabung di kursus MQL Soehoe . . IKut kelas TK aja dulu . .biar belajarnya fokus . .
     
  11. ahmad77

    ahmad77 New Member

    Equity
    Credit
    Ref Point
    //+------------------------------------------------------------------+
    //| EA MArtingale sederhana.mq4 |
    //| Copyright 2021, MetaQuotes Software Corp. |
    //| https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2021, MetaQuotes Software Corp."
    #property link "https://www.mql5.com"
    #property version "1.00"
    #property strict
    //+------------------------------------------------------------------+
    //| Expert initialization function |
    //+------------------------------------------------------------------+

    extern int Magic =9292021;
    extern double Lots = 0.01;
    extern int TakeProfit = 700;
    extern double MultiPlier = 2;
    extern int Step = 400;
    double Lots_sebelumnya,Harga_Sebelumya ;
    int Type_sebelumnya,y,i ;
    double LotMarti;
    int previousOpenOrder;
    //-----------------------------------------------------------------------
    void OnTick()
    {
    int openPertama =0;
    int openPending =0;
    for( i=0; i<OrdersTotal(); i++)
    {
    if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))continue;
    if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=Magic)continue;
    {openPertama++;}
    if(OrderSymbol()!=Symbol()&&(OrderMagicNumber()!=Magic)&&(OrderType()!=OP_BUYLIMIT||OP_SELLLIMIT))
    {openPending++;}
    }

    // [------ Open pertama kali----]
    if (openPertama==0 &&(Close[1]>Open[1]))
    {
    y = OrderSend(Symbol(),OP_BUY,Lots,Ask,10,0,Ask+(TakeProfit*Point),"Ea Marti Sederhana",Magic,0,clrNONE);}
    if (openPertama==0&&(Close[1]<Open[1]))
    {
    y =OrderSend(Symbol(),OP_SELL,Lots,Bid,10,0,Bid-(TakeProfit*Point),"Ea Marti Sederhana",Magic,0,clrNONE);}

    //[--- cek data Op yg sudah ada-------]
    for( i=0;i<OrdersTotal();i++)
    {
    if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))continue;
    if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=Magic)continue;
    Type_sebelumnya = OrderType();
    Lots_sebelumnya = OrderLots();
    Harga_Sebelumya = OrderOpenPrice();
    }
    // [--- Lots untuk Marti nya---]
    LotMarti = NormalizeDouble(Lots_sebelumnya*MultiPlier,2); //Alert(Lots_sebelumnya);

    // [---- code untuk memasang pending lots marti--]
    if (openPending==0&&openPertama>0){
    if(Type_sebelumnya ==OP_BUY ){
    y = OrderSend(Symbol(),OP_BUYLIMIT,LotMarti,Harga_Sebelumya-Step*Point,10,0,(Harga_Sebelumya-Step*Point)+TakeProfit*Point,"MartiAhmad",Magic,0,clrNONE) ;}
    if (Type_sebelumnya ==OP_SELL ){
    y = OrderSend(Symbol(),OP_SELLLIMIT,LotMarti,Harga_Sebelumya+Step*Point,10,0,(Harga_Sebelumya+Step*Point)-TakeProfit*Point,"MartiAhmad",Magic,0,clrNONE) ;}

    }
    // ------[ini code untuk menutup semua posisi ketika salah satu ada yg terkena Tp]-------

    if(previousOpenOrder>openPertama)
    {
    for( i=OrdersTotal();i>=0;i--){
    if (! OrderSelect(i,SELECT_BY_POS,MODE_TRADES))continue;
    if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=Magic)continue;
    if(OrderType()==OP_BUY){y=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,clrBlue);}
    if(OrderType()==OP_SELL){y=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,clrRed);}
    if(OrderType()==OP_SELLLIMIT||OP_BUYLIMIT){y=OrderDelete(OrderTicket());

    }
    } Print ("CLOSE");
    }

    //---[code untuk menghitung openorder serta menghitung previousorder]----
    openPertama =0;
    openPending = 0;
    for ( i=0; i<OrdersTotal(); i++)
    {
    if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))continue;
    if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=Magic)continue;
    {openPertama++;}
    if(OrderSymbol()!=Symbol()&&(OrderMagicNumber()!=Magic) &&(OrderType()!=OP_BUYLIMIT||OP_SELLLIMIT))continue;
    {openPending++;}
    }

    previousOpenOrder =openPertama;

    }
    //+------------------------------------------------------------------+
     
  12. elcodex

    elcodex New Member

    Equity
    Credit
    Ref Point
    izin blajar soehoe .
     

    Attached Files:

  13. Slamet Hariyadi

    Slamet Hariyadi New Member

    Equity
    Credit
    Ref Point
    Mohon bisa di ikutkan di kelas lanjutan, berikut hasil ea sederhana yang sdh saya bikin sendiri dengan sistem marti 2 arah dan trailling stop
     

    Attached Files:

  14. AGUS KASYANTO

    AGUS KASYANTO New Member

    Equity
    Credit
    Ref Point
    // Kumpul tugas, niatnya membuat EA martingale tapi belum selesai, mari kita selesaikan bersama.

    //+------------------------------------------------------------------+
    //| Belajar Membuat EA.mq4 |
    //| Copyright 2020, MetaQuotes Software Corp. |
    //| https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2020, MetaQuotes Software Corp."
    #property link "https://www.mql5.com"
    #property version "1.00"
    #property strict

    extern double Lots = 0.01; // Lots
    extern double TP = 1500; // TP
    extern int Range = 900; // Range
    extern double Multiplier = 1.2; // Multiplier
    extern int Magic = 2222; // Magic Number
    string Comen = "Tugas Kursus Soehoe.id";


    int x;
    //+------------------------------------------------------------------+
    //| Expert initialization function |
    //+------------------------------------------------------------------+
    int OnInit()
    {
    //---

    start();
    // Alert();

    //---
    return(INIT_SUCCEEDED);
    }
    //+------------------------------------------------------------------+
    //| Expert deinitialization function |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
    {
    //---

    }
    //+------------------------------------------------------------------+
    //| Expert tick function |
    //+------------------------------------------------------------------+
    void OnTick()
    {
    //---

    }
    //+------------------------------------------------------------------+
    int start(){

    int TO=0,TB=0,TS=0;
    double ProfitBuy=0,ProfitSell=0,PriceBuy=0,PriceSell=0,LotBuy=0,LotSell=0;

    for(int i=0; i<OrdersTotal(); i++)
    {
    x=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
    if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
    {

    if(OrderType()==OP_BUY)
    {
    TO++;TB++;ProfitBuy+=OrderProfit()+OrderSwap()+OrderCommission();
    if(PriceBuy==0) {PriceBuy=OrderOpenPrice();}
    if(PriceBuy>OrderOpenPrice()) {PriceBuy=OrderOpenPrice();}

    if(LotBuy==0) {LotBuy=OrderLots();}
    if(LotBuy>OrderLots()) {LotBuy=OrderLots();}
    }

    if(OrderType()==OP_SELL)
    {
    TO++;TS++;ProfitSell+=OrderProfit()+OrderSwap()+OrderCommission();
    if(PriceSell==0) {PriceSell=OrderOpenPrice();}
    if(PriceSell<OrderOpenPrice()) {PriceSell=OrderOpenPrice();}

    if( LotSell==0) {LotSell=OrderLots();}
    if( LotSell>OrderLots()) {LotSell=OrderLots();}
    }
    }
    }

    double lt=0;

    if(TB==0) {Buy(Lots);}
    if(TS==0) {Sell(Lots);}

    if(TB>0&&LotBuy>0&&PriceBuy>0&&Ask<=PriceBuy-Range*Point) {
    lt=LotBuy;
    for(int i=0;i<TB;i++) {lt=lt*Multiplier;}
    lt=NormalizeDouble(lt,2);
    Buy(lt);
    }

    if(TS>0&&LotSell>0&&PriceSell>0&&Bid>=PriceSell+Range*Point) {
    lt=LotSell;
    for(int i=0;i<TS;i++) {lt=lt*Multiplier;}
    lt=NormalizeDouble(lt,2);
    Buy(lt);
    }

    if(TB>0&&TP>0&&PriceBuy>0){ModifyTP(0,PriceBuy+TP*Point);}
    if(TS>0&&TP>0&&PriceSell>0){ModifyTP(1,PriceSell-TP*Point);}


    return(0);
    }

    void Buy(double a){
    x=OrderSend(Symbol(),OP_BUY,a,Ask,3,0,0,Comen,Magic,0,clrBlue);
    }

    void Sell(double a){
    x=OrderSend(Symbol(),OP_SELL,a,Bid,3,0,0,Comen,Magic,0,clrRed);
    }


    void ModifyTP(int tipe, double TP_5)
    {
    for (int cnt = OrdersTotal(); cnt >= 0; cnt--)
    {
    x=OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
    if (OrderSymbol() == Symbol() && OrderMagicNumber()==Magic && OrderType()==tipe)
    {
    if (NormalizeDouble (OrderTakeProfit(),Digits)!=NormalizeDouble (TP_5,Digits))
    {
    x=OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), NormalizeDouble (TP_5,Digits), 0, CLR_NONE);
    }
    }
    }
    }
     
  15. DiegoNovoa

    DiegoNovoa New Member

    Equity
    Credit
    Ref Point
    5/5,
    This is my review for this thread:
    excelente
     
  16. DiegoNovoa

    DiegoNovoa New Member

    Equity
    Credit
    Ref Point
    buenas noches estoy tratando de crear un OBJ_RECTANGLE, pero no he podido configurarlo lo llevo asi.



    #property strict
    int OnInit();
    ObjectsDeleteAll();
    QnBanyakKota (20,PERIOD_D1,clrRed);
    //============================
    void QnBanyakKota(int jumlah =10, int TF=PERIOD_D1,color warna =clrGold){
    for (int i=0; j<jumlah; i++){
    kotakwaktu(i,TF,warna);
    }
    }
    //============================
    void kotakwaktu(int jumlah =10, int TF=PERIOD_D1,color warna =clrGold){
    string mysym = _Symbol;
    double p1 = iHigh(mysym,TF,Candle);
    double p2 = iLow(mysym,TF,Candle);
    datetime t1 = iTime(mysym,TF,Candle);
    datetime t2 = t1+TF*60;
    string name = StringConcatenate("Kotak",string (candle),string(TF));
    Kotak(name,t1,t2,p1,p2;warna);
    }
    //============================
    void QnEdit (string myName, int myX=60, int myY=30,color mycolor=clrBlack){

    if (ObjectFind(0,myName)==-1){ObjectCreate(0,myName,OBJ_EDIT,0,0,0);}

    ObjectSetInteger(0,myName,OBJPROP_CORNER,CORNER_RIGHT_LOWER);
    ObjectSetInteger(0,myName,OBJPROP_XDISTANCE,myX);
    ObjectSetInteger(0,myName,OBJPROP_YDISTANCE,myY);
    ObjectSetInteger(0,myName,OBJPROP_XSIZE,width);
    ObjectSetInteger(0,myName,OBJPROP_YSIZE,heigth);
    ObjectSetInteger(0,myName,OBJPROP_FONTSIZE,10);
    ObjectSetInteger(0,myName,OBJPROP_ALIGN,ALIGN_CENTER);

    ObjectSetString(0,myName,OBJPROP_TEXT,"0.01");
    ObjectSetString(0,myName,OBJPROP_FONT,"Arial");

    ObjectSetInteger(0,myName,OBJPROP_COLOR,myColor);


    void createRect(string name_,int width_=100,int height_=100,int corner_=CORNER_RIGHT_UPPER,color bgCol_=clrDarkSlateGray,color borderCol_=clrDarkSlateGray,int x_=0,int y_=0,ENUM_OBJECT type_=OBJ_RECTANGLE)
    {
    if(BuscarObjeto(nombre_)!=0)
    {
    ObjectCreate(0,nombre_,OBJ_RECTANGLE_LABEL,0,0,0);
    }
    ObjectSetInteger(0,nombre_,OBJPROP_BGCOLOR,bgCol_);
    ObjectSetInteger(0,nombre_,OBJPROP_BORDER_TYPE,BORDER_FLAT);
    ObjectSetInteger(0,nombre_,OBJPROP_BORDER_COLOR,borderCol_);
    ObjectSetInteger(0,nombre_,OBJPROP_COLOR,borderCol_);
    ObjectSetInteger(0,nombre_,OBJPROP_XSIZE,ancho_);
    ObjectSetInteger(0,nombre_,OBJPROP_YSIZE,altura_);
    ObjectSetInteger(0,nombre_,OBJPROP_SELECTABLE,0);
    ObjectSetInteger(0,nombre_,OBJPROP_CORNER,esquina_);
    ObjectSetInteger(0,nombre_,OBJPROP_HIDDEN,1);
    ObjectSetInteger(0,nombre_,OBJPROP_YDISTANCE,y_);
    ObjectSetInteger(0,nombre_,OBJPROP_XDISTANCE,x_);
    }
    }
    //========================================
    void OnDeinit (const int reason){
    DeleteObj();
    }
    //========================================
    void OnChartEvent (const int id,
    const long &1param,
    const double &dparam,
    const string &sparam)
    {


    datetime t1 = iTime(_Symbol,PERIOD_D1,1);
    datetime t2 = t1+24*60*60;
    double p1 = iHigh(_Symbol,PERIOD_D1,1);
    double p2 = iLow(_Symbol,PERIOD_D1,1);

    if (id==CHARTEVENT_OBJECT_CLICK){
    if(ObjectGetInteger(0,sparam,OBJPROP_TYPE)==OBJ_BUTTON){
    double Lost = StringToDouble(ObjectGetString(0,editLot,OBJPROP_TEXT));
    if (sparam==btnplus){
    ObjectSetInteger(0,sparam,OBJPROP_STATE,false);
    }
    if (sparam==btnplus){
    Lost-=LoStep;
    ObjectSetInteger(0,sparam,OBJPROP_STATE,false);
    }
    ObjectSetString(0,ediLot,OBJPROP_TEXT,DoubleToStr(Lost,2));
    }
    if (ObjectGetInteger(0,sparam,OBJPROP_TYPE)!=OBJ_HLINE)return;
    if (ObjectGetInteger(0,sparam,OBJPROP_COLOR)=clrYellow){
    Alert(sparam," , d:",dparam," , 1:",1param);
    Kotak("asa12",t1,t2,p1,p2);
    }

    }
    if (i==CHARTEVENT_KEYDOWN)

    }
    //========================================
    void Kotak(string myName, datetime t1, datetime t2, double p1, double p2, color myColor=clrGold);
    if(ObjectFind(0,myName)==-1){ObjectCreate(0,myName,OBJ_EDIT,0,0,0);}

    ObjectSetInteger(0,myName,OBJPROP_PRICE1,p1);
    ObjectSetInteger(0,myName,OBJPROP_PRICE2,p2);
    ObjectSetInteger(0,myName,OBJPROP_TIME1,t1);
    ObjectSetInteger(0,myName,OBJPROP_TIME2,t2);

    ObjectSetInteger(0,myName,OBJPROP_COLOR,myColor);

    ObjectSetInteger(0,myName,OBJPROP_BACK,false);
    ObjectSetInteger(0,myName,OBJPROP_FILL,false);

    //========================================

    si alguien me puede colaborar muchas gracias
     

Share This Page