Senin, 13 Januari 2020

Data Pemesanan
Isi alamat dengan lengkap untuk keperluan pengiriman produk.

contoh : Beben Wahyudi, Perumahan Bella Casa Blok E8 No.2 Rt 03 Rw 23 Kel.Pancoran Mas Kec.Pancoran Mas Kota Depok.
Pengiriman
Jalur Nugraha Ekakurir (JNE)
OKE17,000(2-3 days)
REG19,000(1-2 days)
YES37,000(1-1 days)

Selasa, 20 Mei 2014

Moving Average.mq4

//+------------------------------------------------------------------+
//|                                               Moving Average.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "http://www.mql4.com"
#property description "Moving Average sample expert advisor"

#define MAGICMA  20131111
//--- Inputs
input double Lots          =0.1;
input double MaximumRisk   =0.02;
input double DecreaseFactor=3;
input int    MovingPeriod  =12;
input int    MovingShift   =6;
//+------------------------------------------------------------------+
//| Calculate open positions                                         |
//+------------------------------------------------------------------+
int CalculateCurrentOrders(string symbol)
  {
   int buys=0,sells=0;
//---
   for(int i=0;i<OrdersTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)
        {
         if(OrderType()==OP_BUY)  buys++;
         if(OrderType()==OP_SELL) sells++;
        }
     }
//--- return orders volume
   if(buys>0) return(buys);
   else       return(-sells);
  }
//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double LotsOptimized()
  {
   double lot=Lots;
   int    orders=HistoryTotal();     // history orders total
   int    losses=0;                  // number of losses orders without a break
//--- select lot size
   lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);
//--- calcuulate number of losses orders without a break
   if(DecreaseFactor>0)
     {
      for(int i=orders-1;i>=0;i--)
        {
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false)
           {
            Print("Error in history!");
            break;
           }
         if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL)
            continue;
         //---
         if(OrderProfit()>0) break;
         if(OrderProfit()<0) losses++;
        }
      if(losses>1)
         lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
     }
//--- return lot size
   if(lot<0.1) lot=0.1;
   return(lot);
  }
//+------------------------------------------------------------------+
//| Check for open order conditions                                  |
//+------------------------------------------------------------------+
void CheckForOpen()
  {
   double ma;
   int    res;
//--- go trading only for first tiks of new bar
   if(Volume[0]>1) return;
//--- get Moving Average
   ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
//--- sell conditions
   if(Open[1]>ma && Close[1]<ma)
     {
      res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,0,"",MAGICMA,0,Red);
      return;
     }
//--- buy conditions
   if(Open[1]<ma && Close[1]>ma)
     {
      res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,0,"",MAGICMA,0,Blue);
      return;
     }
//---
  }
//+------------------------------------------------------------------+
//| Check for close order conditions                                 |
//+------------------------------------------------------------------+
void CheckForClose()
  {
   double ma;
//--- go trading only for first tiks of new bar
   if(Volume[0]>1) return;
//--- get Moving Average
   ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
//---
   for(int i=0;i<OrdersTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
      if(OrderMagicNumber()!=MAGICMA || OrderSymbol()!=Symbol()) continue;
      //--- check order type
      if(OrderType()==OP_BUY)
        {
         if(Open[1]>ma && Close[1]<ma)
           {
            if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,White))
               Print("OrderClose error ",GetLastError());
           }
         break;
        }
      if(OrderType()==OP_SELL)
        {
         if(Open[1]<ma && Close[1]>ma)
           {
            if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,White))
               Print("OrderClose error ",GetLastError());
           }
         break;
        }
     }
//---
  }
//+------------------------------------------------------------------+
//| OnTick function                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
//--- check for history and trading
   if(Bars<100 || IsTradeAllowed()==false)
      return;
//--- calculate open orders by current symbol
   if(CalculateCurrentOrders(Symbol())==0) CheckForOpen();
   else                                    CheckForClose();
//---
  }
//+------------------------------------------------------------------+
========

2 Moving Average Cross

//+------------------------------------------------------------------+
//|                                          2 Moving Average Cross |
//|                                  Copyright © 2009, EarnForex.com |
//|                                        http://www.earnforex.com/ |
//+------------------------------------------------------------------+

extern double Lots      = 0.1;
extern int StopLoss     = 35;
extern int TakeProfit   = 70;
extern int TrailingStop = 20;
extern int Slippage     = 3;

extern int Period_1  = 20;
extern int Period_2  = 40;
//0 - SMA, 1 - EMA, 2 - SMMA, 3 - LWMA
extern int MA_Method    = 0;
//The minimum difference between MAs for Cross to count
extern int MinDiff      = 5;

int Magic;
//Depend on broker's quotes
double Poin;
int Deviation;

int LastBars = 0;

//0 - undefined, 1 - bullish cross (fast MA above slow MA), -1 - bearish cross (fast MA below slow MA)
int PrevCross = 0;

int SlowMA;
int FastMA;

//+------------------------------------------------------------------+
//| Initialization                                                   |
//+------------------------------------------------------------------+
int init()
{
   FastMA = MathMin(Period_1, Period_2);
   SlowMA = MathMax(Period_1, Period_2);

    Poin = Point;
    Deviation = Slippage;
    //Checking for unconvetional Point digits number
   if ((Point == 0.00001) || (Point == 0.001))
   {
      Poin *= 10;
      Deviation *= 10;
   }

   Magic = Period()+19472394;
   return(0);
}

//+------------------------------------------------------------------+
//| Start function                                                   |
//+------------------------------------------------------------------+
void start()
{
   if (FastMA == SlowMA)
   {
      Print("MA periods should differ.");
      return;
   }

   if (TrailingStop > 0) DoTrailing();

   //Wait for the new Bar in a chart.
    if (LastBars == Bars) return;
    else LastBars = Bars;

   if ((Bars < SlowMA) || (IsTradeAllowed() == false)) return;
  
   CheckCross();
}

//+------------------------------------------------------------------+
//| Check for cross and open/close the positions respectively        |
//+------------------------------------------------------------------+
void CheckCross()
{
   double FMA_Current = iMA(NULL, 0, FastMA, 0, MA_Method, PRICE_CLOSE, 0);
   double SMA_Current = iMA(NULL, 0, SlowMA, 0, MA_Method, PRICE_CLOSE, 0);
  
   if (PrevCross == 0) //Was undefined
   {
      if ((FMA_Current - SMA_Current) >= MinDiff * Poin) PrevCross = 1; //Bullish state
      else if ((SMA_Current - FMA_Current) >= MinDiff * Poin) PrevCross = -1; //Bearish state
      return;
   }
   else if (PrevCross == 1) //Was bullish
   {
      if ((SMA_Current - FMA_Current) >= MinDiff * Poin) //Became bearish
      {
         ClosePrev();
         fSell();
         PrevCross = -1;
      }
   }
   else if (PrevCross == -1) //Was bearish
   {
      if ((FMA_Current - SMA_Current) >= MinDiff * Poin) //Became bullish
      {
         ClosePrev();
         fBuy();
         PrevCross = 1;
      }
   }
}

//+------------------------------------------------------------------+
//| Close previous position                                          |
//+------------------------------------------------------------------+
void ClosePrev()
{
   int total = OrdersTotal();
   for (int i = 0; i < total; i++)
   {
      if (OrderSelect(i, SELECT_BY_POS) == false) continue;
      if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == Magic))
      {
         if (OrderType() == OP_BUY)
         {
            RefreshRates();
            OrderClose(OrderTicket(), OrderLots(), Bid, Deviation);
         }
         else if (OrderType() == OP_SELL)
         {
            RefreshRates();
            OrderClose(OrderTicket(), OrderLots(), Ask, Deviation);
         }
      }
   }
}

//+------------------------------------------------------------------+
//| Sell                                                             |
//+------------------------------------------------------------------+
int fSell()
{
    double SL, TP;
    RefreshRates();
    if (StopLoss > 0) SL = Bid + StopLoss * Poin;
    else SL = 0;
   if (TakeProfit > 0) TP = Bid - TakeProfit * Poin;
    else TP = 0;   
    int result = OrderSend(Symbol(), OP_SELL, Lots, Bid, Deviation, SL, TP, "Adjustable MA", Magic);
    if (result == -1)
    {
        int e = GetLastError();
        Print(e);
    }
    else return(result);
}

//+------------------------------------------------------------------+
//| Buy                                                              |
//+------------------------------------------------------------------+
int fBuy()
{
    double SL, TP;
    RefreshRates();
    if (StopLoss > 0) SL = Ask - StopLoss * Poin;
    else SL = 0;
   if (TakeProfit > 0) TP = Ask + TakeProfit * Poin;
    else TP = 0;   
    int result = OrderSend(Symbol(), OP_BUY, Lots, Ask, Deviation, SL, TP, "Adjustable MA", Magic);
    if (result == -1)
    {
        int e = GetLastError();
        Print(e);
    }
    else return(result);
}

void DoTrailing()
{
   int total = OrdersTotal();
   for (int pos = 0; pos < total; pos++)
   {
      if (OrderSelect(pos, SELECT_BY_POS) == false) continue;
      if ((OrderMagicNumber() == Magic) && (OrderSymbol() == Symbol()))
      {
         if (OrderType() == OP_BUY)
         {
            RefreshRates();
            if (Bid - OrderOpenPrice() >= TrailingStop * Poin) //If profit is greater or equal to the desired Trailing Stop value
            {
               if (OrderStopLoss() < (Bid - TrailingStop * Poin)) //If the current stop-loss is below the desired trailing stop level
                  OrderModify(OrderTicket(), OrderOpenPrice(), Bid - TrailingStop * Poin, OrderTakeProfit(), 0);
            }
         }
         else if (OrderType() == OP_SELL)
         {
            RefreshRates();
            if (OrderOpenPrice() - Ask >= TrailingStop * Poin) //If profit is greater or equal to the desired Trailing Stop value
            {
               if (OrderStopLoss() > (Ask + TrailingStop * Poin)) //If the current stop-loss is below the desired trailing stop level
                  OrderModify(OrderTicket(), OrderOpenPrice(), Ask + TrailingStop * Poin, OrderTakeProfit(), 0);
            }
         }
      }
   }  
}

//+------------------------------------------------------------------+

HedgeLot_EA.mq4

//+------------------------------------------------------------------+
//|                                                  HedgeLot_EA.mq4 |
//|                                     Copyright © 2009, metropolis |
//|                                           metropolisfx@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, metropolis"
#property link      "metropolisfx@yahoo.com"

extern int  TP = 35;
extern int  SL = 10;
extern double InstantLot = 0.1;
extern double PendingLot = 0.3;

#define Slippage 2
#define id1 12345
#define id2 67890

//global variables
static datetime lastB = -1;
static datetime lastS = -1;
static datetime lastClose = -1;
static double nextLot;
static double levelBuy;
static double levelSell;
static bool firstRun;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
Comment("\n", "     Broker Time         : ",TimeToStr(TimeCurrent()),"\n",
        "\n", "     Stop Level           : ",MarketInfo(Symbol(),MODE_STOPLEVEL),
        "\n", "     Orders Total        : ",OrdersTotal(),"\n",
        "\n", "     Copyright © 2009, metropolis - metropolisfx@yahoo.com");
        
if(!IsTradeAllowed())
{
   Print("Server tidak mengizinkan trade");
   Sleep(5000);
   return(0);
}
if(IsTradeContextBusy())
{
   Print("Trade context is busy. Tunggu sebentar");
   Sleep(5000);
   return(0);
}
if(!IsConnected())
{
   Print("Nggak ada koneksi untuk order dari EA ke server");
   Sleep(5000);
   return(0);
}
if(MarketInfo(Symbol(),MODE_STOPLEVEL)>TP || MarketInfo(Symbol(),MODE_STOPLEVEL)>SL)
{
   Print("Stop Level lebih besar dari pada SL atau TP");
   return(0);


if(!firstRun)
{      
   for (int i=OrdersHistoryTotal()-1;i>=0;i--)
   {
      OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==id2 && OrderProfit()>0 )
      {
         if(OrderType()==OP_SELL && OrderOpenTime()==lastS)
         { 
            deleteAll(OP_BUYSTOP);
            lastS = -1;
            Sleep(5000);
         }
          
         if(OrderType()==OP_BUY && OrderOpenTime()==lastB)
         { 
            deleteAll(OP_SELLSTOP); 
            lastB = -1;
            Sleep(5000);
         }
      }
   }        
}

manageTrade();

if(OrdersTotal()==0) firstRun();

  
//----
   return(0);
  }
//+------------------------------------------------------------------+

double p()
{
   double p;
   if(Digits==5 || Digits==3) p = 10*(MarketInfo(Symbol(),MODE_POINT));
   else p = MarketInfo(Symbol(),MODE_POINT);
   return (p);


void openOrder(string simbol, int trade, double lotsize, double price, double sl, double tp,string pesan, int magic, color warna)
{                    
   int tiket=OrderSend(simbol,trade,lotsize,price,Slippage,sl,tp,pesan,magic,0,warna);                             
   if(tiket>0)
   { 
        if(OrderSelect(tiket,SELECT_BY_TICKET,MODE_TRADES)) OrderPrint();
   }
   else Print("Tidak bisa buka order karena : ",GetLastError());       
}

void firstRun()
{//

   RefreshRates();
   int spread = MarketInfo(Symbol(),MODE_SPREAD);

   //buy
   double buyTP = Ask+(TP-spread)*p();
   double buySL = Ask-SL*p();
   openOrder(Symbol(),OP_BUY,InstantLot,Ask,buySL,buyTP,"buy awal",id1,Blue);
   levelBuy = Ask;
  
   //sell
   double sellTP = Bid-(TP-spread)*p();
   double sellSL = Bid+SL*p();
   openOrder(Symbol(),OP_SELL,InstantLot,Bid,sellSL,sellTP,"sell awal",id1,Red);
   levelSell = Bid;
  
   //buystop
   openOrder(Symbol(),OP_BUYSTOP,PendingLot,buyTP+spread*p(),Bid,buyTP+TP*p(),"buy lanjut",id2,Blue);
  
   //sellstop
   openOrder(Symbol(),OP_SELLSTOP,PendingLot,sellTP-spread*p(),Ask,sellTP-TP*p(),"sell lanjut",id2,Red);
  
   nextLot = PendingLot*2;
   firstRun = true;
}

void manageTrade()
{
   int i;
   int spread = MarketInfo(Symbol(),MODE_SPREAD);
   bool NewBuyExist = false;
   bool NewSellExist = false;
  
   for (i=OrdersTotal()-1;i>=0;i--)// mencari  order terakhir buystop yang menjadi buy
   {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==id2 && OrderType()==OP_BUY)
         {
            if(lastB != OrderOpenTime())
            {
               lastB = OrderOpenTime();
               levelBuy = OrderOpenPrice();
               NewBuyExist = true;
               break;
            } 
         }
      }
   }
  
  
   for (i=OrdersTotal()-1;i>=0;i--)// mencari order terakhir sell stop yang menjadi sell
   {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==id2 && OrderType()==OP_SELL)
         {
            if(lastS != OrderOpenTime())
            {
               lastS = OrderOpenTime(); // order terakhir sell dicatet waktunya
               levelSell = OrderOpenPrice();
               NewSellExist = true;
               break;
            } 
         }
      }
   }
  
   if(NewBuyExist)
   {
      if(firstRun)
      {
         for(i=0;i<OrdersTotal();i++)
         {
            OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
            if(OrderSymbol()==Symbol() && OrderMagicNumber()==id2 && OrderType()==OP_SELLSTOP)
            {
               OrderDelete(OrderTicket());
               firstRun = false;
            } 
         }
      }
     
      if(!firstRun)
      {
         double sellTP = levelSell-(TP-spread)*p();
         double sellSL = levelSell+SL*p();
         openOrder(Symbol(),OP_SELLSTOP,nextLot,levelSell,sellSL,sellTP,"sell lanjut",id2,Red);
         nextLot *= 2;
      }
  
   }
  
   if(NewSellExist)
   {
      if(firstRun)
      {
         for(i=0;i<OrdersTotal();i++)
         {
            OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
            if(OrderSymbol()==Symbol() && OrderMagicNumber()==id2 && OrderType()==OP_BUYSTOP)
            {
               OrderDelete(OrderTicket());
               firstRun = false;
            } 
         }
      }
     
      if(!firstRun)
      {
         double buyTP = levelBuy+(TP-spread)*p();
         double buySL = levelBuy-SL*p();
         openOrder(Symbol(),OP_BUYSTOP,nextLot,levelBuy,buySL,buyTP,"buy lanjut",id2,Blue);
         nextLot *= 2;
      }
   }

//---

}//


void deleteAll( int trade)
{
   int i;
  
   for (i=0;i<OrdersTotal();i++)
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if(OrderSymbol()==Symbol())
   {
      if(OrderType()==trade) OrderDelete(OrderTicket());
   }
}

Rabu, 30 April 2014

Ngoprek EA 2

Salam sukses semuanya

Sepertinya harus dilengkapi pada posting saya Ngoprex 1
Senenarnya saya menunggu -nunggu temen2 yang hasil oprekan temen2 , tapi ternyata gak ada yang muncul, baru beberapa orang yang sempat menghubungi di Ym tetntang EA Setka

Nah dalam kesempatan ini saya akan share hasil oprekan versi saya , unguk menambah wawan

Nah ini hasilnya ...silahkan dicopas


//===========================================================================================================================//
// Author VOLDEMAR227 site WWW.TRADING-GO.RU      SKYPE: TRADING-GO          e-mail: TRADING-GO@List.ru
//===========================================================================================================================//
#property copyright "Copyright © 2013, ngoprex by Jumforex.blogspot.com"
#property link      "http://WWW.TRADING-GO.RU"
//===========================================================================================================================//
extern string  nGoPrex_by = "Jumforex.blogspot.com";
extern double  Risiko_inMoney = 1000;
extern double  Target_Persen  = 100;
extern bool    Close_Panic= false;
extern string    Hari_Trade         = "=>Sesuai selera::";
extern bool      Senin              = true;
extern bool      Selasa             = true;
extern bool      Rabu               = true;
extern bool      Kamis              = true;
extern bool      Jumat              = true;

extern string  Comment_1 = "settings";
extern int     Plus= 50;
extern int     TakeProfit = 11;
extern int     Range = 17;
extern double  Lots    = 0.00;
extern double  Percent    = 1;

extern bool    Martin     = true;

extern string  Comment_2 = "signalMA";
extern bool    SignalMA = false;
extern int     PeriodMA1 = 8 ;
extern int     PeriodMA2 = 14 ;

extern string  Comment_3 = "signalRSI";
extern bool    SignalRSI = true;
extern int     PeriodRSI = 14 ;
extern int     up= 40;
extern int     dw= 60;

extern string  Comment_4 = "signalProc";
extern bool    Proc    =true;
extern double  Procent    =1.3;

extern int     Slip=2;
extern int     Magic=1;
double bal,xc;string st;
int init()
  {
 bal= AccountBalance();
   return(0);
  }

int start()   {
 if(!IsDemo() ){ Alert("Maaf bos versi demo , hubungi : ym: gifaesa ...");  return(0);}
if(AccountEquity() <= bal - Risiko_inMoney){
  cL(0);
  cL(1);
  Alert(" Waduh Prehatin Bro");
  return(0);
  }
if(Close_Panic){
  cL(0);
  cL(1);
  Alert(" Tenang Bro dunia belum Berakhir");
  return(0);
}
bool tr=false;
xc=(bal*Target_Persen/100);
if(AccountEquity()>=bal+xc){
  cL(0);
  cL(1);
  Alert(" Hore Target udah sampe tujuan selamat");
  tr=true;
  }
double Lots_New=0;
 string Symb   =Symbol();              
   double One_Lot=MarketInfo(Symb,MODE_MARGINREQUIRED);
   double Min_Lot=MarketInfo(Symb,MODE_MINLOT);
   double Step   =MarketInfo(Symb,MODE_LOTSTEP);
   double Free   =AccountFreeMargin();       
//--------------------------------------------------------------- 3 --
   if (Lots>0)                              
     {                                       
      double Money=Lots*One_Lot;         
      if(Money<=AccountFreeMargin())        
         Lots_New=Lots;                  
      else                               
         Lots_New=MathFloor(Free/One_Lot/Step)*Step;
     }
//--------------------------------------------------------------- 4 --
   else                                   
     {                                      
      if (Percent > 100)                 
         Percent=100;                   
      if (Percent==0)               
         Lots_New=Min_Lot;                 
      else                     
         Lots_New=MathFloor(Free*Percent/100/One_Lot/Step)*Step;//????
     }
//--------------------------------------------------------------- 5 --
   if (Lots_New < Min_Lot)                 
      Lots_New=Min_Lot;                 
   if (Lots_New*One_Lot > AccountFreeMargin())
     {                                        
      return(false);                       
     }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
   ObjectCreate("R",OBJ_LABEL,0,0,0);
   ObjectSet("R",OBJPROP_CORNER,2);
   ObjectSet("R",OBJPROP_XDISTANCE,10);
   ObjectSet("R",OBJPROP_YDISTANCE,10);
   ObjectSetText("R","from: WWW.TRADING-GO.RU  ,nGoPrex by Jumforex.blogspot.com",21,"Mistral",Aqua);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
   double opB=2000; double opS=0; double orderProfitbuy=0; double Sum_Profitbuy=0; double orderProfitsel;  double Sum_Profitsel; int orderType;
   double LotB=Lots_New;
   double LotS=Lots_New;
   int total=OrdersTotal();
   int b=0,s=0,n=0;
   for(int i=total-1; i>=0; i--)     {
      if(OrderSelect(i, SELECT_BY_POS))
        {
         if(OrderSymbol()==Symbol()      )
           {
            n++;
            if(OrderType()==OP_BUY && OrderMagicNumber()==Magic)
              {
               b++;
               LotB=OrderLots();
               double ProfitB=OrderTakeProfit(); double openB=OrderOpenPrice();
               if(openB<opB)
                 {opB=openB;}
              }
            //---------------------------------     
            if(OrderType()==OP_SELL && OrderMagicNumber()==Magic)
              {
               s++;
               LotS=OrderLots();
              double ProfitS=OrderTakeProfit(); double openS=OrderOpenPrice();
               if(openS>opS)
                 {opS=openS;}
              }
           }
        }
     }
   double max = NormalizeDouble(iHigh(Symbol(),1440,0),Digits);
   double min = NormalizeDouble(iLow (Symbol(),1440,0),Digits);
   double opp=NormalizeDouble(iOpen(Symbol(),1440,0),Digits);
   double cl=NormalizeDouble(iClose(Symbol(),1440,0),Digits);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
   double dis   =NormalizeDouble(Range*Point,Digits);
   double spred =NormalizeDouble(MarketInfo(Symbol(),MODE_SPREAD)*Point,Digits);
   double  CORR=NormalizeDouble(Plus            *Point,Digits);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//  
int sigup=0;
int sigdw=0;
double RS=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,1);
int sig,sg;
if (SignalMA == true)
{
if(MA(PeriodMA1,2)<MA(PeriodMA2,2)&& MA(PeriodMA1,1)>MA(PeriodMA2,1))sig=1;
if(MA(PeriodMA1,2)>MA(PeriodMA2,2)&& MA(PeriodMA1,1)<MA(PeriodMA2,1))sig=2;

}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
if (SignalRSI == true)
{
if(RS<up)sg=1;
if(RS>dw)sg=2;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
if (Proc    ==true)
{
   if(cl>min) { double x=NormalizeDouble(cl*100/min-100,2); }
   if(cl<max) { double y=NormalizeDouble(cl*100/max-100,2); }
  
if (Procent*(-1)<=y&&Close[1]>Open[1]){ sigup=1; sigdw=0; }
if (Procent     >=x&&Close[1]<Open[1]){ sigup=0; sigdw=1; } 
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
   int f=0;
   if(Martin==true)
     {
        if (total==0){f=1    ;}
        if (total>=1){f=total;}
         LotB=Lots_New*f;
         LotS=Lots_New*f;
     }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
if(Martin==false)
  {
LotB=LotS;
LotS=LotB;
  }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 
if(!tr && !Close_Panic &&  tday()==1 && IsDemo()){
if((!SignalMA && !SignalRSI && b==0&&sigup==1&&s==0)||(SignalMA && !SignalRSI && b==0&&sigup==1&&s==0 && sig==1)||(!SignalMA && SignalRSI && b==0&&sigup==1&&s==0 && sg==1)||(SignalMA && SignalRSI && b==0&&sigup==1&&s==0&& sig==1&& sg==1)||(Ask<opB-dis+spred&&b>=1&&s==0)) { OrderSend(Symbol(),OP_BUY ,LotB,Ask,Slip,0,0,"Jum69Buy+"+b,Magic,0,Green); }
if((!SignalMA && !SignalRSI && s==0&&sigdw==1&&b==0)||(SignalMA && !SignalRSI && s==0&&sigdw==1&&b==0 && sig==2)||(!SignalMA && SignalRSI && s==0&&sigdw==1&&b==0 && sg==2)||(SignalMA && SignalRSI && s==0&&sigdw==1&&b==0&& sig==2&& sg==2)||(Bid>opS+dis+spred&&s>=1&&b==0)) { OrderSend(Symbol(),OP_SELL,LotS,Bid,Slip,0,0,"Jum69Sell+"+s,Magic,0,Green); }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
double TP= NormalizeDouble (spred+TakeProfit*Point,Digits);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
 if(AccountEquity()<bal+xc && s+b>0) st=" SabaR menunggu ,Target masih dikejar...sabar!";  else
 if(AccountEquity()<bal+xc && s+b==0) st=" SabaR menunggu kabar Signal dari langit!"; else
 if(tr) st=" Hore Target udah sampe tujuan selamat";

   for (int iq=total-1; iq>=0; iq--)
   {
    if(OrderSelect(iq, SELECT_BY_POS))
     {
      if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Magic)
       {  
        if (OrderType()==OP_BUY  &&  OrderTakeProfit()==0 && b==1)
         {
          OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(OrderOpenPrice()+TP,Digits),0,Blue); 
         }    
        if (OrderType()==OP_SELL && OrderTakeProfit()==0 && s==1)
         {
          OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(OrderOpenPrice()-TP,Digits),0,Blue); 
         }
}}}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
double nn=0,bb=0;
for(int ui=total-1; ui>=0; ui--)
  {
   if(OrderSelect(ui,SELECT_BY_POS))
     {
      if(OrderSymbol()==Symbol())
        {
         if(OrderType()==OP_BUY && OrderMagicNumber()==Magic)
           {
            double op=OrderOpenPrice();
            double llot=OrderLots();
            double itog=op*llot;
            bb=bb+itog;
            nn=nn+llot;
            double factb=bb/nn;
           }
        }
     }
  }
double nnn=0,bbb=0;
for(int usi=total-1; usi>=0; usi--)
  {
   if(OrderSelect(usi,SELECT_BY_POS))
     {
      if(OrderSymbol()==Symbol())
        {
         if(OrderType()==OP_SELL && OrderMagicNumber()==Magic)
           {
            double ops=OrderOpenPrice();
            double llots=OrderLots();
            double itogs=ops*llots;
            bbb=bbb+itogs;
            nnn=nnn+llots;
            double facts=bbb/nnn;
           }
        }
     }
  }

for(int uui=total-1; uui>=0; uui--)
  {
   if(OrderSelect(uui,SELECT_BY_POS))
     {
      if(OrderSymbol()==Symbol())
        {
         if(b>=2 && OrderType()==OP_BUY && OrderMagicNumber()==Magic)
           {
            OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(factb+CORR,Digits),0,Blue);
           }
         if(s>=2 && OrderType()==OP_SELL && OrderMagicNumber()==Magic)
           {
            OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(facts-CORR,Digits),0,Blue);
           }
        }
     }
    
  }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  Comment("\n ",
   "\n ",
   "\n ------------------------------------------------",
   "\n :: Spread                 : ", MarketInfo(Symbol(), MODE_SPREAD),
   "\n :: Leverage               : 1 : ", AccountLeverage(),
   "\n :: Jam Server             :", Hour(), ":", Minute(),
   "\n ------------------------------------------------",
   "\n :: Equity Sekarang        : ", AccountEquity(),
   "\n :: Floting                : ", mon(),
   "\n :: Target      : ", Target_Persen, " Persen, @Equety :", bal+xc,"$",
   "\n :: Posisi    :", st,
   "\n ------------------------------------------------",
   "\n :: nGopRex By: Jum69",
   "\n ------------------------------------------------");
   
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
 void cL(int m)
{
 for (int i = OrdersTotal() - 1; i >= 0; i--) {
  OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
  if (OrderSymbol() != Symbol() || OrderMagicNumber()!=Magic || OrderType()!=m) continue;
  if (OrderType() > 1) OrderDelete(OrderTicket());
  if (OrderType() == 0) OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE);
  if (OrderType() == 1)OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE);
 }
}
 double mon()
{
 double t;
 for (int i = OrdersTotal() - 1; i >= 0; i--) {
  OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
  if (OrderSymbol() != Symbol() || OrderMagicNumber()!=Magic ) continue;
  t+=OrderProfit();
 }
 return(t);
}

double MA(int Per,int s){ return(iMA(NULL,0,Per,8,MODE_SMMA,PRICE_MEDIAN,s));  }
int tday()
{
int trd=0;
if(Senin  && DayOfWeek()==1) trd=1;
if(Selasa && DayOfWeek()==2) trd=1;
if(Rabu   && DayOfWeek()==3) trd=1;
if(Kamis  && DayOfWeek()==4) trd=1;
if(Jumat  && DayOfWeek()==5) trd=1;
return(trd);
}

======================
Jangan lupa ea di atas ada proteksi demonya silahkan untuk dicoba

semoga bermanfaat

Salam sukses
 *copas dari http://jumforex.blogspot.com