J'ai repris ce matin le MODULO cf https://miniurl.be/r-1p1s
Bien que je ne comprenne absolument rien à sa strategie ,j'ai essayé d'apporter quelques modifications interressantes.
Merci d'apporter a votre tour votre pierre pour bonifier cet EA originalement bizarre :)
Le Trailing stop ne sert a rien ….je l'ai retiré
Bien que je ne comprenne absolument rien à sa strategie ,j'ai essayé d'apporter quelques modifications interressantes.
Merci d'apporter a votre tour votre pierre pour bonifier cet EA originalement bizarre :)
Le Trailing stop ne sert a rien ….je l'ai retiré
Code
//+------------------------------------------------------------------+
//| MODULO LOTS AUTOAJUSTES TP ST | |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| PARTAMETRES EURUSD 1 MN | |
//+------------------------------------------------------------------+
extern int MagicNumber=20180810; //magic
double LotSize; //lotsize
extern double LotFactor = 9.5; //lotsize factor
extern int StopLoss=5475; //stop loss
extern int TakeProfit=570; //take profit
double pips = 0.00001; //leave as default for 5 digit brokers
int stopOK = 0; // ne pas modifier
int sendOK = 0; // ne pas modifier
int long_court=1; // 0 = Long & 1 = Court
int gain=1; // no comment ;)
int c=0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double MyPoint=Point;
if(Digits==3 || Digits==5) MyPoint=Point*10;
if(IsNewCandle())
{
Lot_Volume(); //calc lotsize
return(0);
}
//MODIF***********
if(c==0){bool modify1=OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,Ask-(StopLoss*pips),Ask+(TakeProfit*pips),NULL,MagicNumber,0,Green);;c=1;}
//MODIF***********
Comment(AccountEquity() - AccountBalance());
int type = OrderType();
int type2 = OrderType();
if (Hour()==1 && Minute()==1 && Seconds()==1 && sendOK==0)
{
sendOK=1;stopOK=0;
if(long_court==1)
{
bool modify2=OrderSend(Symbol(),OP_SELL,LotSize,Bid,3,Bid+(StopLoss*pips),Bid-(TakeProfit*pips),NULL,MagicNumber,0,Red);
}
if(long_court==0)
{
bool modify3=OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,Ask-(StopLoss*pips),Ask+(TakeProfit*pips),NULL,MagicNumber,0,Green);
}
}
if (Hour()>=23 && stopOK==0)
{
stopOK=1;sendOK=0;
int u = OrdersTotal() - 1;
while (u >= 0)
{
if (OrderSelect(u, SELECT_BY_POS))
if (type == OP_SELLSTOP || type == OP_BUYSTOP)
{
bool modify7= OrderDelete(OrderTicket());
}
u -= 1;
}
}
if (AccountEquity()>= AccountBalance()+ gain)
{
int w = OrdersTotal() - 1;
while (w >= 0)
{
if(OrderSelect(w, SELECT_BY_POS))
{
bool modify4=OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 2);
bool modify5=OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 2);
}
w -= 1;
}
//MODIF***********
bool modify6=OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,Ask-(StopLoss*pips),Ask+(TakeProfit*pips),NULL,MagicNumber,0,Green);
//MODIF***********
}
return(0);
}
//+------------------------------------------------------------------+
//insuring its a new candle function
//+------------------------------------------------------------------+
bool IsNewCandle()
{
static int BarsOnChart=0;
if (Bars == BarsOnChart)
return (false);
BarsOnChart = Bars;
return(true);
}
//+------------------------------------------------------------------+
//calculates lot size based on balance and factor
//+------------------------------------------------------------------+
double Lot_Volume()
{
double lot;
if (AccountBalance()>=50) lot=0.02;
if (AccountBalance()>=75) lot=0.03;
if (AccountBalance()>=100) lot=0.04;
if (AccountBalance()>=125) lot=0.05;
if (AccountBalance()>=150) lot=0.06;
if (AccountBalance()>=175) lot=0.07;
if (AccountBalance()>=200) lot=0.08;
if (AccountBalance()>=225) lot=0.09;
if (AccountBalance()>=250) lot=0.1;
if (AccountBalance()>=275) lot=0.11;
if (AccountBalance()>=300) lot=0.12;
if (AccountBalance()>=325) lot=0.13;
if (AccountBalance()>=350) lot=0.14;
if (AccountBalance()>=375) lot=0.15;
if (AccountBalance()>=400) lot=0.16;
if (AccountBalance()>=425) lot=0.17;
if (AccountBalance()>=450) lot=0.18;
if (AccountBalance()>=475) lot=0.19;
if (AccountBalance()>=500) lot=0.2;
if (AccountBalance()>=550) lot=0.24;
if (AccountBalance()>=600) lot=0.26;
if (AccountBalance()>=650) lot=0.28;
if (AccountBalance()>=700) lot=0.3;
if (AccountBalance()>=750) lot=0.32;
if (AccountBalance()>=800) lot=0.34;
if (AccountBalance()>=850) lot=0.36;
if (AccountBalance()>=900) lot=0.38;
if (AccountBalance()>=1000) lot=0.4;
if (AccountBalance()>=1500) lot=0.6;
if (AccountBalance()>=2000) lot=0.8;
if (AccountBalance()>=2500) lot=1.0;
if (AccountBalance()>=3000) lot=1.2;
if (AccountBalance()>=3500) lot=1.4;
if (AccountBalance()>=4000) lot=1.6;
if (AccountBalance()>=4500) lot=1.8;
if (AccountBalance()>=5000) lot=2.0;
if (AccountBalance()>=5500) lot=2.2;
if (AccountBalance()>=6000) lot=2.4;
if (AccountBalance()>=7000) lot=2.8;
if (AccountBalance()>=8000) lot=3.2;
if (AccountBalance()>=9000) lot=3.6;
if (AccountBalance()>=10000) lot=4.0;
if (AccountBalance()>=15000) lot=6.0;
if (AccountBalance()>=20000) lot=8.0;
if (AccountBalance()>=30000) lot=12;
if (AccountBalance()>=40000) lot=16;
if (AccountBalance()>=50000) lot=20;
if (AccountBalance()>=60000) lot=24;
if (AccountBalance()>=70000) lot=28;
if (AccountBalance()>=80000) lot=32;
if (AccountBalance()>=90000) lot=36;
if (AccountBalance()>=100000) lot=40;
if (AccountBalance()>=200000) lot=80;
LotSize=lot/LotFactor;
return(LotSize);
}