//+------------------------------------------------------------------+
//| WL SuddenBibL Limited MultiStrength 25.mq4 |
//| Copyright 2024, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+-------------------------------------------ص------(هو نفس غانم3 المطور يختلف في الماجيك والتعليق واضافة ميدهاي و ميدلو وافترميد ووظيفته وعكس جميع الصفقات)-----------------+
extern int Magic = 3800;
bool cdm=false;
int AccMagic=3200;
int Magic1 = Magic+1;
int Magic2 = Magic+2;
int Magic3 = Magic+3;
int Magic4 = Magic+4;
int Magic5 = Magic+5;
int Magic6 = Magic+6;
int Magic7 = Magic+7;
int Magic8 = Magic+8;
int MagicStop=1000000;
int MagicRestart=1100000;
int MagicStopSymbol=777777;
int MagicStopSymbolX1=444444;
int MagicStopSymbolX2=555555;
double Lot =0.01;
int Frx=1;
double lot =Lot;
double lotBig =lot*10;
bool UXN=true;
bool UF=false;
int EnoughB=15000;
double StopLoss=0;
double TKA=0.9;
double TakeProfit=StopLoss*TKA;
extern string ghanem ="A0";
string ghanem1 ="A1";
string ghanem2 ="A2";
string ghanem3 ="A0b";
string ghanem4 ="A1b";
string ghanem5 ="A2b";
string ghanem6 ="A0c";
string ghanem7 ="A1c";
string ghanem8 ="A2c";
string ghanemStart ="ghStart";
string ghanemStopSymbol ="StopSymbol";
string ghanemStopSymbolX1 ="StopSymbolX1";
string ghanemStopSymbolX2 ="StopSymbolX2";
double ticksize;
extern double t;
double Buys,Buyt,Sells,Sellt;
int PriceSpace=50;
extern int PriceSpaceP=90;
extern int PriceSpaceL=30;
double Multi =lot;
double MultiL =1.5;
double MultiP =0;
double HighestLot=10;
double Highest=HighestLot*Frx;
double AfterHigest=lot;
double LowestLot=lot;
double AfterLowest=lot;
extern double sum=7.5;
double Frr,Bal;
int Frm;
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);
if (ticksize == 0.00001 ||0.001)
t = ticksize*10;
else
t = ticksize;
Print("lotBigX()=",lotBigX(),"MylotX1()=",MylotX1(),"MyOrderStopSymbolX1()=",MyOrderStopSymbolX1(),"BlotX1=",BlotX1(),"magic=",OrderMagicNumber(),"Lastlot=",lastlotX0(),"Blot=",BlotX0(),"Mylot=",MylotX0(),"Profit=",MyProfitX0(),"OrType=",MyTypeX0());
//--- create timer
EventSetTimer(60);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if (StopLoss == 0) Buys=0;
else Buys = Ask-(StopLoss*t);
if (TakeProfit == 0) Buyt=0;
else Buyt = Ask+(TakeProfit*t);
//-----------------
if (StopLoss == 0) Sells=0;
else Sells = Bid+(StopLoss*t);
if (TakeProfit == 0) Sellt=0;
else Sellt = Bid-(TakeProfit*t);
//=================
double AskP=Ask+1000*t;
//=================
Bal=AccountBalance();
if(UF==true)
Frr=Bal/EnoughB;
//===========
if(UF==true)
Frm=MathFloor(Frr);
if(UF==true&&Frm>1&&Frm<8)
Frx=Frm;
if(UF==true&&Frm>8)
Frx=8;
//========ORDERS=======+++++++++++++
if(MyOrderStop()==0&&cdm==false)
{
//========MyOrderStopSymbol================
if(LevelStopSymbolX1()==true&&MyOrderStopSymbolX1()==0&&MyOrderX1()>0)
OrderSend(Symbol(),OP_BUYSTOP,0.01,AskP,2,0,0,ghanemStopSymbolX1,MagicStopSymbolX1,0,Blue);
if(LevelStopSymbolX2()==true&&MyOrderStopSymbolX2()==0&&MyOrderX2()>0)
OrderSend(Symbol(),OP_BUYSTOP,0.01,AskP,2,0,0,ghanemStopSymbolX2,MagicStopSymbolX2,0,Blue);
//---111111111111-------Mylot line 393----------
if (MyOrderX1()==0&&MyOrderStopSymbolX1()==0)
// if (MyOrderX1()==0&&MyProfitX1()<=0)
OrderSend(Symbol(),OP_SELL,MylotX1(),Bid,3,Sells,Sellt,ghanem1,Magic1,0,Red);
//-------22222222222---------------
if (MyOrderX2()==0&&MyOrderStopSymbolX2()==0)
OrderSend(Symbol(),OP_BUY,MylotX2(),Ask,3,Buys,Buyt,ghanem2,Magic2,0,Blue);
}
//============Delete MyOrderStopSymbol==============
if(MyOrderStopSymbolX1()>0&&MyOrderX1()==0)
OrderDelete(MyOrderStopSymbolX1());
if(MyOrderStopSymbolX2()>0&&MyOrderX2()==0)
OrderDelete(MyOrderStopSymbolX2());
//============Close=X1==X2=========
if(MyOrderStopSymbolX1()>0&&OrderSelect(MyOrderX1(),SELECT_BY_TICKET,MODE_TRADES)==true)
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,Red||Blue);
if(MyOrderStopSymbolX2()>0&&OrderSelect(MyOrderX2(),SELECT_BY_TICKET,MODE_TRADES)==true)
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,Red||Blue);
if (MyOrderStop()>0&&MyOrderX1()>0&&OrderSelect(MyOrderX1(),SELECT_BY_TICKET,MODE_TRADES)==true)
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,Red||Blue);
if (MyOrderStop()>0&&MyOrderX2()>0&&OrderSelect(MyOrderX2(),SELECT_BY_TICKET,MODE_TRADES)==true)
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,Red||Blue);
if (MyOrderStop()>0&&MyOrderAll()>0&&OrderSelect(MyOrderAll(),SELECT_BY_TICKET,MODE_TRADES)==true)
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,Red||Blue);
}
//=====FUNCTIONS=======++++++===========
double StrengthX()
{
double y=1;
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect (i,SELECT_BY_POS,MODE_TRADES);
if(OrderComment()==ghanemStart)
y=OrderLots();
}
return(y*100);
}
//=======
double lotBigX()
{
double y=lotBig*StrengthX();
return(y);
}
//=====
int MyOrderAll()
{
int y=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect (i,SELECT_BY_POS,MODE_TRADES);
if(OrderMagicNumber()<MagicStop||OrderType()<=1)
y=OrderTicket();
}
return(y);
}
//===============
bool LevelStopSymbol()
{
bool y=false;
if(Ask>=MyOrderOpenPriceX2()+PriceSpace*t)
y=true;
if(Bid<=MyOrderOpenPriceX1()-PriceSpace*t)
y=true;
return(y);
}



ساحة النقاش