There is not a expert adviser, is a code to add to yours experts.
=================================================
//+------------------------------------------------------------------+
//| test1.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
extern int MagicNumber=123;
extern double StartLotsize=0.01;
extern double MultiplierLot=2.0;
extern double StepOrder=10;
extern int MaxGrid=3;
//---------------------------------------------------------------------------------------
int MultiplierPoint;
double DigitsPoints;
int BuyCnt;
int SellCnt;
double PipsBuy;
double PipsSell;
bool SendBuy;
bool SendSell;
double LotBuy;
double LotSell;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
MultiplierPoint=1;
if(MarketInfo(Symbol(),MODE_DIGITS)==5||MarketInfo(Symbol(),MODE_DIGITS)==3) MultiplierPoint=10;
DigitsPoints=MarketInfo(Symbol(),MODE_POINT)*MultiplierPoint;
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
BuyCnt=0;
SellCnt=0;
PipsBuy=0;
PipsSell=0;
SendBuy=false;
SendSell=false;
LotBuy=StartLotsize;
LotSell=StartLotsize;
//----
for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY)
{
BuyCnt++;
PipsBuy=(Bid-OrderOpenPrice())/DigitsPoints;
}
if(OrderType()==OP_SELL)
{
SellCnt++;
PipsSell=(OrderOpenPrice()-Ask)/DigitsPoints;
}
}
}
}
//----
if((BuyCnt<MaxGrid)&&(PipsBuy>=StepOrder))
{
LotBuy=NormLot(StartLotsize*MathMax(1,MathPow(MultiplierLot,BuyCnt)));
SendBuy=true;
}
if((SellCnt<MaxGrid)&&(PipsSell>=StepOrder))
{
LotSell=NormLot(StartLotsize*MathMax(1,MathPow(MultiplierLot,SellCnt)));
SendSell=true;
}
//----
if(SendBuy==true)
{
//send orders buy... with lot=LotBuy
return(0);
}
//----
if(SendSell==true)
{
//send orders sell... with lot=LotSell
return(0);
}
//----
return(0);
}
//+------------------------------------------------------------------+
//Normalize lot //
double NormLot(double LotSize)
{
int LotDigit;
//------------------------------------------------------
//Broker lot info
double MinLot=MarketInfo(Symbol(),MODE_MINLOT);
double MaxLot=MarketInfo(Symbol(),MODE_MAXLOT);
double LotStep=MarketInfo(Symbol(),MODE_LOTSTEP);
//------------------------------------------------------
//Calculate lot digits
if(LotStep==1) LotDigit=0;
if(LotStep==0.1) LotDigit=1;
if(LotStep==0.01) LotDigit=2;
if(LotStep==0.001) LotDigit=3;
//------------------------------------------------------
return(NormalizeDouble(MathMin(MathMax(LotSize,MinLot),MaxLot),LotDigit));
}
Bang bisa buatkan sy expert martingale. Tanpa indi. Jd open posisi dan lot manual, setelah itu expert langsung mengikuti dgn martingale
ReplyDeleteSaya punya EA martingel,bisa di atur untuk OP manual ataupun OP automatic.
Deleteshare
DeleteHello, i have an expert advisor and don't know how to add your martingale code on it, help me please
ReplyDelete