extern int MA_length = 10;
extern int MA_timeframe = 30; // hdb did I add this ? lol
extern int MAtype = 0;//0=close, 1=HL
extern double Percent = 0.1;
extern int TradeOnFriday = 1; // >0 trades on friday
extern int slip = 100;//exits only
extern double Lots = 0.01; // modified by Renato
extern int TakeProfit = 30;
extern int Stoploss = 500;// total loss on all open positions in pips // modified by Renato
extern int Fast_Period=23;
extern int Fast_Price = PRICE_OPEN;
extern int Slow_Period=84;
extern int Slow_Price = PRICE_OPEN;
extern double DivergenceLimit=0.002;
extern int PipStep = 30;//if position goes this amount of pips against you add another.
extern double IncreasementType = 0;//0=just add every PipStep, >0 =OrdersToal()^x *Pipstep
double Stopper=0;
double KeepStopLoss=0;
double KeepAverage;
double dummy;
double spread=0;
double CurrentPipStep;
int OrderWatcher=0;
int maxDD=0;
int maxOO=0;
extern int DVLimit = 10; // included by Renato
extern int PipsGoal = 500; // included by Renato
extern int PipsLoss = 500; // included by Renato
color clOpenBuy = DodgerBlue; // included by Renato
color clModiBuy = DodgerBlue; // included by Renato
color clCloseBuy = DodgerBlue; // included by Renato
color clOpenSell = Red; // included by Renato
color clModiSell = Red; // included by Renato
color clCloseSell = Red; // included by Renato
color clDelete = White; // included by Renato
string Name_Expert = "Firebird v63D"; // included by Renato
string NameFileSound = "expert.wav"; // included by Renato
int MODE_DIV=0; // included by Renato
int MODE_SLOPE=1; // included by Renato
int MODE_ACEL=2; // included by Renato
extern int GMT = 2; // InterbankFX // included by Renato
extern int DST = 0; // 0=Standard 1=Daylight Saving // included by Renato
extern int OpeningHour = 0; // included by Renato
extern int ClosingHour = 23; // included by Renato
extern int writelog = 0;
int init() {
// код доступен только после оплаты
}
int start()
{
// код доступен только после оплаты
}
LogWrite(TimeToStr(CurTime())+" - "+"Bid="+Bid);
int MagicNumber=MagicfromSymbol();
Comment(MagicNumber);
switch(MagicNumber) {// included by Renato
case 26910: // EURUSD,M30 // optmized 06/03/20
MA_length=18; // George's setting
MA_timeframe=30;
MAtype=0;
Percent=0.15; // George's setting
TradeOnFriday=1;
slip=100;
Lots=0.05;
TakeProfit=30; // George's setting
Stoploss=300;
PipStep=5;
IncreasementType=0.0;
DVLimit = 8; // included by Renato
OpeningHour = 6; // included by Renato
ClosingHour = 14; // included by Renato
break;
case 25803: // GBPUSD,M30
MA_length=18;
MA_timeframe=30;
MAtype=0;
Percent=0.25;
TradeOnFriday=1;
slip=100;
Lots=0.05;
TakeProfit=30;
Stoploss=100;
PipStep=5;
IncreasementType=0.0;
DVLimit = 8; // included by Renato
OpeningHour = 7; // included by Renato
ClosingHour = 15; // included by Renato
break;
case 26715: // EURCHF,M30 // optmized 06/03/20
MA_length=18;
MA_timeframe=30;
MAtype=0;
Percent=0.1;
TradeOnFriday=1;
slip=100;
Lots=0.05;
TakeProfit=10;
Stoploss=300;
PipStep=7;
IncreasementType=0.0;
DVLimit = 6; // included by Renato
OpeningHour = 6; // included by Renato
ClosingHour = 14; // included by Renato
break;
/*case : // USDCHF,M30
DVLimit = 8; // included by Renato
OpeningHour = 6; // included by Renato
ClosingHour = 14; // included by Renato
break;*/
/*case : // USDJPY,M30
DVLimit = 8; // included by Renato
OpeningHour = 23; // included by Renato
ClosingHour = 7; // included by Renato
break;*/
/*case : // USDAUD,M30
DVLimit = 8; // included by Renato
OpeningHour = 23; // included by Renato
ClosingHour = 6; // included by Renato
break;*/
/*default:
if (!(IsTesting() || IsDemo()))
Alert("This advisor is suited for the EURUSD,M30 or GBPUSD,M30 charts only");
return(0);
break;
*/}
double PriceTarget;
double AveragePrice;
int OpeningDay;
if ( DayOfWeek()==6 && Hour()>=20 ) { Comment("weekend"); return(0); } // included by Renato
if ( !(IsTesting() || IsDemo()) ) { if (LossCheck()) { Alert("excessive loss!"); PlaySound("alert.wav"); return(0); }} // included by Renato
double diverge;
if(AccountBalance()-AccountEquity() > maxDD) maxDD=AccountBalance()-AccountEquity();
if(MyOrdersTotal()>maxOO) maxOO=OrdersTotal(); //modified by Renato
diverge=divergence(Fast_Period,Slow_Period,Fast_Price,Slow_Price,0);
Comment("maxDrawDown=",maxDD," maxOrdersOpen=",maxOO," Current Divergence = ",diverge);
CurrentPipStep=PipStep;
if(IncreasementType>0)
{
CurrentPipStep=MathSqrt(MyOrdersTotal())*PipStep; // modified by Renato
CurrentPipStep=MathPow(MyOrdersTotal(),IncreasementType)*PipStep; // modified by Renato
}
LogWrite("CurrentPipStep="+CurrentPipStep);
int Direction=0;//1=long, 11=avoid long, 2=short, 22=avoid short
if (Day()!=5 || TradeOnFriday >0)
{
int cnt=0, total;
int myTotal =0; // hdb
total=OrdersTotal();
LogWrite("OrdersTotal="+OrdersTotal());
LogWrite("MyOrdersTotal="+MyOrdersTotal());
if(MyOrdersTotal()==0) OpeningDay=DayOfYear(); // modified by Renato
for(cnt=0;cnt<total;cnt++)
{
if ( (OrderSymbol()==Symbol()) && (OrderMagicNumber()==MagicNumber) && (OrderComment()==GetCommentForOrder()) ) // hdb - only symbol and magic // modified by Renato
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
double LastPrice=OrderOpenPrice();
myTotal = myTotal +1; // hdb - count of relevant trades
}
}
LogWrite("LastPrice="+LastPrice);
datetime orderclosetime;
string rightnow;
int rightnow2;
int TheHistoryTotal=HistoryTotal();
int difference;
int flag=0;
for(cnt=0;cnt<TheHistoryTotal;cnt++)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)==true)
{
if ( (OrderSymbol()==Symbol()) && (OrderMagicNumber()==MagicNumber) && (OrderComment()==GetCommentForOrder()) ) // hdb - only symbol and magic // modified by Renato
{
orderclosetime=OrderCloseTime();
rightnow=Year()+"-"+Month()+"-"+Day()+" "+Hour()+":"+Minute()+":"+Seconds();
rightnow2=StrToTime(rightnow);
difference=rightnow2-orderclosetime;
if(Period()*60*2>difference)
{ // At least 2 periods away!
flag=1; // Throw a flag
break;
}
}
}
}
if(flag!=1)
{
OrderWatcher=0;
total=OrdersTotal();
for(cnt=(total-1);cnt>=0;cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if ( (OrderSymbol()==Symbol()) && (OrderMagicNumber()==MagicNumber) && (OrderComment()==GetCommentForOrder()) ) // hdb - only symbol and magic // modified by Renato
{
LastPrice=OrderOpenPrice();
break;
}
}
LogWrite("LastPrice="+LastPrice);
if(MathAbs(diverge)<=DivergenceLimit) {
if ( Hour()<OpeningHour+GMT+DST || Hour()>ClosingHour+GMT+DST ) Comment("bad hours."); else { // included by Renato
/*if ( (iCustom(NULL,0,"iFXAnalyser",MODE_DIV,0)>DVLimit*Point
&& iCustom(NULL,0,"iFXAnalyser",MODE_SLOPE,0)>0 )
|| (iCustom(NULL,0,"iFXAnalyser",MODE_DIV,0)<-DVLimit*Point
&& iCustom(NULL,0,"iFXAnalyser",MODE_SLOPE,0)<0 ) ) { Comment("trending market!");} else {// included by Renato*/
double RVI=iRVI(NULL,0,10,MODE_MAIN,0)-iRVI(NULL,0,10,MODE_MAIN,1); // included by Renato
if(MAtype==0)
{
double myMA =iMA(NULL,MA_timeframe,MA_length,0,MODE_SMA,PRICE_OPEN,0);
if( (myMA*(1+Percent/100))<Bid && Direction!=22 && (Bid>=(LastPrice+(CurrentPipStep*Point)) || MyOrdersTotal()==0) && RVI<0 ) // modified by Renato
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,slip,Bid+(Stoploss*Point),Bid-(TakeProfit*Point),GetCommentForOrder(),MagicNumber,0,clOpenSell); // modified by Renato
OrderWatcher=1;
Direction=2;
}
if((myMA*(1-Percent/100))>Ask && Direction!=11 && (Ask<=(LastPrice-(CurrentPipStep*Point)) || MyOrdersTotal()==0) && RVI>0 ) // Go LONG -> Only buy if >= 30 pips below previous position entry // modified by Renato
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,slip,Ask-(Stoploss*Point),Ask+(TakeProfit*Point),GetCommentForOrder(),MagicNumber,0,clOpenBuy); // modified by Renato
OrderWatcher=1;
Direction=1;
}
}
if(MAtype==1)
{
if((iMA(NULL,MA_timeframe,MA_length,0,MODE_SMA,PRICE_HIGH,0)*(1+Percent/100))<Bid && Direction!=22 && (Bid>=(LastPrice+(CurrentPipStep*Point)) || MyOrdersTotal()==0)) // Go SHORT -> Only sell if >= 30 pips aПоказано первые 50% кода (символов: 13560)
Введите ваш email и нажмите кнопку, чтобы перейти к оплате.