# EA to View Open Trades

711

Does Anyone Know of an EA, Indicator or Utility I can download to view the amount of current open trades on my account?
I have been looking around and all I found was people who has posted coding scripts.

Regards Franzel
1575

What do you mean by "amount" ? Is total number of lots? Total lots value ? or what?

Please kindly be specific to get the right answer as I'm a coder and have such functions

I use in my codes to get such statistics and easily can put it in a stand alone EA here.

711

Osama Shaban:

What do you mean by "amount" ? Is total number of lots? Total lots value ? or what?

Please kindly be specific to get the right answer as I'm a coder and have such functions

I use in my codes to get such statistics and easily can put it in a stand alone EA here.

I am using an EA that does multiple hedging across multiple currency pairs and it is difficult to keep track on the number of open trades.
Moderator
33339

1575

Franzel Botha:
I am using an EA that does multiple hedging across multiple currency pairs and it is difficult to keep track on the number of open trades.

Use this simple code. It will give you the number of open trades in both directions separately.

int cnt, total;
int i = 0;
total = OrdersTotal();
for(cnt=0; cnt<total; cnt++){
i++;
}
return(i);
}

int cnt, total;
int i = 0;
total = OrdersTotal();
for(cnt=0; cnt<total; cnt++){
if(OrderSymbol()==smbl && OrderType()==OP_SELL && OrderMagicNumber()==MagicNo)
i++;
}
return(i);
}

711

Osama Shaban:

Use this simple code. It will give you the number of open trades in both directions separately.

int cnt, total;
int i = 0;
total = OrdersTotal();
for(cnt=0; cnt<total; cnt++){
i++;
}
return(i);
}

int cnt, total;
int i = 0;
total = OrdersTotal();
for(cnt=0; cnt<total; cnt++){
if(OrderSymbol()==smbl && OrderType()==OP_SELL && OrderMagicNumber()==MagicNo)
i++;
}
return(i);
}

Thank you for the code.
I tried adding it to my EA code, but my EA doesn't work after adding the code.
Here is my EA code.

string invalid_ac="" ;
string contact_person="";
string expire_com= "";
bool ExpiredTime_ON=true;
int emonth=12;   int eday=31; int eyear=2050;
string EA_NAME="Double UP EA ";
bool Filter_Time_For_Trial=true;
int dyear=2000; int dmonth=1;
enum Ordertype
{
SellOnly=2
};

input double X_Amount_OfMinute_UST =5;
input double X_Amount_OfMinute_ST =5;
input Ordertype    ChooseOrder            = 1;
//bool    sell           = true;
input string  XXXXXXXXXXXXXXXXXX= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
enum USE_TP
{
YES=1,
NO=2
};

int i;
bool Autolot=false;
double AutoMM =1;
//input double Lot=0.01;
double LastLot;
//input double Multiplier_Lot=2;
input string XXXXXXXXXXXXXXXXXXXXXXXXXX   = "All Calculate In Pip";
USE_TP TP_SL_InPip=1;
input double    TakeProfit     = 50;
input double    Stoploss       = 30;
string XXXXXXXXXXlXXXXXXXXXXXXXXXX   = "All Calculate In Amount";
double    Multiplier_TP=2;
double    TakeProfit_InAmount     = 2;
double    Stoploss_InAmount       = 2;

input bool    CloseBY_Trailing_Stop = false;
input  double    Trailing_Stop        = 10;
input  double    Trailing_Start       = 10;

double  X=0;
string XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   = "";
input int    slippage        = 999999;
extern int       Magic_Number        = 18882;
bool Ord_Modif;
int  cnt,Select,Ord_Send,Close_Ord,CO_Orders;
double SLB,SLS,TPS,TPB;
datetime x_time,y_time,CO_Time,CO_Time2;
double XX_Price,XX_SL,YY_Price,YY_SL;
int his_xy,his_kkk,his_mmm;
int kkk,mmm;
double min_loss,XYZ;
double total_l_in;
double total_yp,pv,avg_yy;
int Co_Time,Co_Time2;
//=============================================================================||//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
//---

if( Digits==3|| Digits==5)pip=10; else pip=1;

//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
CleanUp();

}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{

if ( MarketInfo (NULL,MODE_MINLOT) <=0.01 ) Lot_Digit=2;
if ( MarketInfo (NULL,MODE_MINLOT) ==0.1 ) Lot_Digit=1;
if ( MarketInfo (NULL,MODE_MINLOT) ==1 ) Lot_Digit=0;

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
if( ExpiredTime_ON)
{
if ((Year()>eyear) || (Year()==eyear && Month()>emonth) || (Year()==eyear && Month()==emonth && Day()>eday))
{

if(ObjectFind("expiredlabel") != 0)
{
ObjectCreate("expiredlabel", OBJ_LABEL, 0,0,0);
ObjectSetText("expiredlabel",expire_com,14, "Cambria", White);
ObjectSet("expiredlabel", OBJPROP_XDISTANCE,5);
ObjectSet("expiredlabel", OBJPROP_YDISTANCE,15);
ObjectSet("expiredlabel", OBJPROP_CORNER, 1);

ObjectCreate("Contact_Me", OBJ_LABEL, 0,0,0);
ObjectSetText("Contact_Me",contact_person ,14, "Cambria", Lime);
ObjectSet("Contact_Me", OBJPROP_XDISTANCE,5);
ObjectSet("Contact_Me", OBJPROP_YDISTANCE,5);
ObjectSet("Contact_Me", OBJPROP_CORNER, 3);
}
return;
}
}
//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK||
if (DayOfWeek()==1) hari= Day1;
if (DayOfWeek()==2) hari= Day2;
if (DayOfWeek()==3) hari= Day3;
if (DayOfWeek()==4) hari= Day4;
if (DayOfWeek()==5) hari= Day5;
if (DayOfWeek()==6) hari= Day6;
if (DayOfWeek()==7) hari= Day7;

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
CO_Orders=0; CO_Time=0; CO_Time2=0;
kkk=0; mmm=0;
// LastLot=0;
min_loss=0;
total_l_in=0;
for(cnt=0; cnt<OrdersHistoryTotal(); cnt++)
// for(cnt=HistoryTotal()-1; cnt>=0;cnt--)
{
Select=OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY);
if ( OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number )
{
CO_Orders++;
his_xy=OrderType();
LastLot=OrderLots();
min_loss=OrderProfit();

}

if ( OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number &&OrderProfit()<0)
{
kkk++;
mmm=0;
CO_Time=OrderCloseTime();
his_kkk =OrderType();
total_l_in+=OrderProfit()+OrderCommission()+OrderSwap();
// min_loss=OrderProfit();
// LastLot=OrderLots();
}// else LastLot=FixLot;

if ( OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number &&OrderProfit()>0)
{
mmm++;
his_mmm =OrderType();
kkk=0;
total_l_in=0;
CO_Time2=OrderCloseTime();
// min_loss=0;

}

if ( OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number&& OrderType()==0 )
{

XX_Price=OrderClosePrice();
XX_SL=OrderStopLoss();
}

if ( OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number&& OrderType()==1 )
{

YY_Price=OrderClosePrice();
YY_SL=OrderStopLoss();
}

}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
int OpenBuy    = 0;     int OpenSell    = 0;
XYZ=0;
int OpenOrders    = 0; xy_order= 0;
int PendingOrders = 0; xy_time=0;
x_time=0; y_time=0;
//total_yp=0; avg_yy=0;
for( cnt=0; cnt<OrdersTotal(); cnt++)
{
if (OrderSymbol()==Symbol()&& OrderMagicNumber() == Magic_Number)
{
OpenOrders++;
xy_order++;
xy_time=OrderOpenTime();
XYZ+=OrderProfit();
C_LOT+=OrderLots();
}

if (OrderSymbol()==Symbol() &&OrderMagicNumber() == Magic_Number && OrderType()==1 )
{
OpenSell++;
y_time=OrderOpenTime();
SellPrice=OrderOpenPrice();
// avg_yy+= NormalizeDouble(total_yp/C_LOT,Digits);
}

if (OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number && OrderType()==0 )
{
x_time=OrderOpenTime();
//avg_yy+= NormalizeDouble(total_yp/C_LOT,Digits);
}

}
if (TP_SL_InPip==1)
{
SLS=Bid+Stoploss*pip*Point;
}
else if (TP_SL_InPip==1)
{
SLB=0;
SLS=0;
}

if (TP_SL_InPip==2)
{
TPS=Bid-TakeProfit*pip*Point;
}
else if (TP_SL_InPip==2)
{
TPB=0;   TPS=0;
}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
if (ChooseOrder==1 && kkk<=0)
{
if ( OpenOrders==0  && Filter_Trial()  &&NormalizeDouble( TimeCurrent()- CO_Time2//OrderCloseTime()
,0)>= 60*X_Amount_OfMinute_ST)//&& kkk==0

{

}
}
//=============================================================================||
if (ChooseOrder==2 && kkk<=0)
//if (sell==true)
{
if ( OpenOrders==0  && Filter_Trial()  &&NormalizeDouble( TimeCurrent()- CO_Time2//OrderCloseTime()
,0)>= 60*X_Amount_OfMinute_ST)//&& kkk==0

{
Ord_Send= OrderSend(Symbol(),OP_SELL,AutoLot(),Bid,slippage,SLS,TPS,"SellOrder",Magic_Number,0,Magenta);
}
}

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
if (ChooseOrder==1 && kkk>0)
{
if ( OpenOrders==0  && Filter_Trial()  &&NormalizeDouble( TimeCurrent()- CO_Time//OrderCloseTime()
,0)>= 60*X_Amount_OfMinute_UST)//&& kkk==0

{

}
}
//=============================================================================||
if (ChooseOrder==2 && kkk>0)
//if (sell==true)
{
if ( OpenOrders==0   && Filter_Trial()  &&NormalizeDouble( TimeCurrent()- CO_Time//OrderCloseTime()
,0)>= 60*X_Amount_OfMinute_UST)// && kkk==0

{
Ord_Send= OrderSend(Symbol(),OP_SELL,AutoLot(),Bid,slippage,SLS,TPS,"SellOrder",Magic_Number,0,Magenta);
}
}

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
if (TP_SL_InPip==2 && min_loss>=0  )
{
//int cnt;
for(cnt=OrdersTotal()-1; cnt>=0;cnt--)
{
if (OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number)
{
{
Close_Ord=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Blue);
}
if ( (OrderType()==OP_SELL &&  OpenSell>0&& OrderProfit()>=TakeProfit_InAmount)
|| (OrderType()==OP_SELL && OpenSell>0 && OrderProfit()<= -Stoploss_InAmount)  )
{
Close_Ord=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Red);
}
}
}
}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
/*
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
if (TP_SL_InPip==2 && min_loss< 0 )
{
//int cnt;
for(cnt=OrdersTotal()-1; cnt>=0;cnt--)
{
if (OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number)
{
{
Close_Ord=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Blue);
}
if ( (OrderType()==OP_SELL &&  OpenSell>0&& OrderProfit()>=Multiplier_TP*(-min_loss))
|| (OrderType()==OP_SELL && OpenSell>0 && OrderProfit()<= Multiplier_Lot*(min_loss) )  )
{
Close_Ord=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Red);
}
}
}
}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
*/
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
if (CloseBY_Trailing_Stop==true )
{
for( i=OrdersTotal()-1;i>=0;i--)
{
if (OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number)
{
{
if(Trailing_Stop>0)
{
if(Bid-OrderOpenPrice()>Point*Trailing_Stop*pip)// 1000-800 > 60
{
if(OrderStopLoss()<Bid-Point*Trailing_Stop*pip)
{
Ord_Modif=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*Trailing_Stop*pip,OrderTakeProfit(),0,Lime);
return;
}
}
}
}

else  if (OrderType()==OP_SELL && kkk<=0 && OpenSell>0)
{
if(Trailing_Stop>0)
{
{
{
return;
}
}
}
}

}
}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||

pv=NormalizeDouble(MarketInfo(NULL,MODE_TICKVALUE),Digits);
if (OpenSell>0 && kkk>0)
{
Sell_BEP=NormalizeDouble (SellPrice+ (total_l_in/C_LOT/pv)*Point,Digits) ;

}

{
}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
double Trail_Begin=Trailing_Start;
{
for( i=OrdersTotal()-1;i>=0;i--)
{
if (OrderSymbol()==Symbol() && OrderMagicNumber() == Magic_Number)
{
{
if(Trailing_Start>0)
{
{
if(OrderStopLoss()<Bid-Point*Trailing_Start*pip)
{
Ord_Modif=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*Trailing_Start*pip,OrderTakeProfit(),0,Lime);
return;
}
}
}
}

else  if (OrderType()==OP_SELL && kkk>0 && OpenSell>0)
{
if(Trailing_Start>0)
{
{
{
return;
}
}
}
}

}
}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||

//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
if(ACCOUNT_INFO)
{
Range = NormalizeDouble(( iHigh(NULL,1440,0)- iLow(NULL,1440,0))/Point,0);
Balance = AccountBalance();
Equity = AccountEquity();
Profit = AccountProfit();
Lev = AccountLeverage();

Running_Price = DoubleToStr (Bid,Digits);
Range_Price   = DoubleToStr (Range,0);
AB            = DoubleToStr(Balance,2);
AE            = DoubleToStr(Equity,2);
AP            = DoubleToStr(XYZ,2);

Leverage             = DoubleToStr (Lev,0);

if ( Filter_Trial()==false)

{
string_window( "EA Trial", 5, 5, 0);
ObjectSetText( "EA Trial","Not Allow Trial at This Periode Trial Only From : " + DoubleToStr(dyear,0)+ " ." + DoubleToStr(dmonth,0) + " ." ,
15, "Impact", Magenta);
ObjectSet( "EA Trial", OBJPROP_CORNER,2);

}  else ObjectDelete("EA Trial");

string_window( "hari", 5, 18, 0); //
ObjectSetText( "hari",hari +", "+DoubleToStr( Day(),0)+" - "+DoubleToStr(Month(),0) +" - "
+DoubleToStr(Year(),0) ,text_size+1, "Impact", Yellow);
ObjectSet( "hari", OBJPROP_CORNER,text_corner);
string_window( "Balance", 5, 15+20, 0); //
ObjectSetText( "Balance","Balance   : " + AB , text_size, "Cambria", color_text);
ObjectSet( "Balance", OBJPROP_CORNER,text_corner);

string_window( "Equity", 5, 30+20, 0); //
ObjectSetText( "Equity","Equity     : " + AE , text_size, "Cambria", color_text);
ObjectSet( "Equity", OBJPROP_CORNER, text_corner);

string_window( "Profit", 5, 45+20, 0);
ObjectSetText( "Profit", "Profit    : \$ " +  DoubleToStr(XYZ,2) , text_size, "Cambria", color_text);
ObjectSet( "Profit", OBJPROP_CORNER, text_corner);

/*
string_window( "DD", 5,60+20, 0);
ObjectSetText( "DD","DD   : " +  DoubleToStr(DD,2)+" %" , text_size, "Cambria", color_text);
ObjectSet( "DD", OBJPROP_CORNER, text_corner);
*/

string_window( "Range", 5, 75+20, 0); //
ObjectSetText( "Range","Range : " + DoubleToStr(Range/pip,1) , text_size, "Cambria", color_text);
ObjectSet( "Range", OBJPROP_CORNER, text_corner);

string_window( "Price", 5, 90+20, 0); //
ObjectSetText( "Price","Price : " + DoubleToStr(Bid,Digits) , text_size, "Cambria", color_text);
ObjectSet( "Price", OBJPROP_CORNER, text_corner);

string_window( "Buy", 5, 125, 0); //

string_window( "Diff", 5, 140, 0); //
ObjectSetText( "Diff","Leverage : " + DoubleToStr(Lev,0) , text_size, "Cambria", color_text);
ObjectSet( "Diff", OBJPROP_CORNER, text_corner);

string_window( "TL", 5, 140+15, 0); //
ObjectSetText( "TL","Total Loss : \$ " + DoubleToStr(total_l_in,2) , text_size, "Cambria", color_text);
ObjectSet( "TL", OBJPROP_CORNER, text_corner);

{

string_window( "BuyPrice", 5, 155+15, 0); //

string_window( "Buy_BEP", 5, 155+30 , 0); //

string_window( "C_LOT", 5, 155+45, 0); //
ObjectSetText( "C_LOT","Order Lot :  " + DoubleToStr(C_LOT,2) , text_size, "Cambria", color_text);
ObjectSet( "C_LOT", OBJPROP_CORNER, text_corner);
/*
string_window( "Buy_BEP1", 5, 155+60 , 0); //
*/

if (OpenSell>0 && kkk>0)
{

string_window( "SellPrice", 5, 155+15, 0); //
ObjectSetText( "SellPrice","SellPrice :  " + DoubleToStr(SellPrice,Digits) , text_size, "Cambria", color_text);
ObjectSet( "SellPrice", OBJPROP_CORNER, text_corner);

string_window( "Sell_BEP", 5, 155+30 , 0); //
ObjectSetText( "Sell_BEP","Sell_BEP :  " +  DoubleToStr(SellPrice+ (total_l_in/C_LOT/pv)*Point,Digits) , text_size, "Cambria", color_text);
ObjectSet( "Sell_BEP", OBJPROP_CORNER, text_corner);

string_window( "C_LOT", 5, 155+45, 0); //
ObjectSetText( "C_LOT","Order Lot :  " + DoubleToStr(C_LOT,2) , text_size, "Cambria", color_text);
ObjectSet( "C_LOT", OBJPROP_CORNER, text_corner);
/*
string_window( "Sell_BEP1", 5, 155+60, 0); //
ObjectSetText( "Sell_BEP1","Sell_BEP :  " + DoubleToStr(Sell_BEP,Digits) , text_size, "Cambria", color_text);
ObjectSet( "Sell_BEP1", OBJPROP_CORNER, text_corner);
*/
}  else { ObjectDelete("SellPrice");     ObjectDelete("Sell_BEP");   ObjectDelete("C_LOT");}

string_window( "EA_NAME", 5, 5, 0);
ObjectSetText( "EA_NAME", EA_NAME , text_size+5, "Impact", Yellow);
ObjectSet( "EA_NAME", OBJPROP_CORNER, 3);
}
//return;
}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
int Lot_Digit;
input double Lot1=0.01;
input double Lot2=0.02;
input double Lot3=0.03;
input double Lot4=0.04;
input double Lot5=0.05;
input double Lot6=0.06;
input double Lot7=0.07;
input double Lot8=0.10;
input double Lot9=0.15;
input double Lot10=0.20;
input double Lot11=0.21;
input double Lot12=0.22;
input double Lot13=0.23;
input double Lot14=0.24;
input double Lot15=0.25;
input double Lot16=0.26;
input double Lot17=0.27;
input double Lot18=0.28;
input double Lot19=0.29;
input double Lot20=0.30;
input double Lot21=0.31;
input double Lot22=0.32;
input double Lot23=0.33;
input double Lot24=0.34;
input double Lot25=0.35;
input double Lot26=0.36;
input double Lot27=0.37;
input double Lot28=0.38;
input double Lot29=0.39;
input double Lot30=0.40;
input double Lot31=0.41;
input double Lot32=0.42;
input double Lot33=0.43;
input double Lot34=0.44;
input double Lot35=0.45;
input double Lot36=0.50;
input double Lot37=0.51;
input double Lot38=0.52;
input double Lot39=0.53;
input double Lot40=0.54;

input double Lot41=0.55;
input double Lot42=0.56;
input double Lot43=0.57;
input double Lot44=0.58;
input double Lot45=0.6;
input double Lot46=0.61;
input double Lot47=0.63;
input double Lot48=0.65;
input double Lot49=0.7;
input double Lot50=1.00;

input double Lot51=1.55;
input double Lot52=1.56;
input double Lot53=1.57;
input double Lot54=1.58;
input double Lot55=1.6;
input double Lot56=1.61;
input double Lot57=1.63;
input double Lot58=1.65;
input double Lot59=1.7;
input double Lot60=2.00;

input double Lot61=2.55;
input double Lot62=2.56;
input double Lot63=2.57;
input double Lot64=2.58;
input double Lot65=2.6;
input double Lot66=2.61;
input double Lot67=2.63;
input double Lot68=2.65;
input double Lot69=2.7;
input double Lot70=3.00;

input double Lot71=3.55;
input double Lot72=3.56;
input double Lot73=3.57;
input double Lot74=3.58;
input double Lot75=3.6;
input double Lot76=3.61;
input double Lot77=3.63;
input double Lot78=3.65;
input double Lot79=3.7;
input double Lot80=3.00;
input double Lot81=4.55;
input double Lot82=4.56;
input double Lot83=4.57;
input double Lot84=4.58;
input double Lot85=4.6;
input double Lot86=4.61;
input double Lot87=4.63;
input double Lot88=4.65;
input double Lot89=4.7;
input double Lot90=4.00;
input double Lot91=5.55;
input double Lot92=5.56;
input double Lot93=5.57;
input double Lot94=5.58;
input double Lot95=5.6;
input double Lot96=5.61;
input double Lot97=5.63;
input double Lot98=5.65;
input double Lot99=5.7;
input double Lot100=6.00;

double AutoLot()
{
Lots=0;
if ( kkk<=0 )
{
Start_Lot= NormalizeDouble(Lot1,Lot_Digit);
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

if ( kkk>0 && kkk==1)
{
Start_Lot= NormalizeDouble(Lot2,Lot_Digit);
}

if ( kkk>0 && kkk==2)
{
Start_Lot= NormalizeDouble(Lot3,Lot_Digit);
}

if ( kkk>0 && kkk==3)
{
Start_Lot= NormalizeDouble(Lot4,Lot_Digit);
}

if ( kkk>0 && kkk==4)
{
Start_Lot= NormalizeDouble(Lot5,Lot_Digit);
}

if ( kkk>0 && kkk==5)
{
Start_Lot= NormalizeDouble(Lot6,Lot_Digit);
}

if ( kkk>0 && kkk==6)
{
Start_Lot= NormalizeDouble(Lot7,Lot_Digit);
}

if ( kkk>0 && kkk==7)
{
Start_Lot= NormalizeDouble(Lot8,Lot_Digit);
}

if ( kkk>0 && kkk==8)
{
Start_Lot= NormalizeDouble(Lot9,Lot_Digit);
}

if ( kkk>0 && kkk==9)
{
Start_Lot= NormalizeDouble(Lot10,Lot_Digit);
}

if ( kkk>0 && kkk==10)
{
Start_Lot= NormalizeDouble(Lot11,Lot_Digit);
}

if ( kkk>0 && kkk==11)
{
Start_Lot= NormalizeDouble(Lot12,Lot_Digit);
}

if ( kkk>0 && kkk==12)
{
Start_Lot= NormalizeDouble(Lot13,Lot_Digit);
}

if ( kkk>0 && kkk==13)
{
Start_Lot= NormalizeDouble(Lot14,Lot_Digit);
}

if ( kkk>0 && kkk==14)
{
Start_Lot= NormalizeDouble(Lot15,Lot_Digit);
}

if ( kkk>0 && kkk==15)
{
Start_Lot= NormalizeDouble(Lot16,Lot_Digit);
}

if ( kkk>0 && kkk==16)
{
Start_Lot= NormalizeDouble(Lot17,Lot_Digit);
}
if ( kkk>0 && kkk==17)
{
Start_Lot= NormalizeDouble(Lot18,Lot_Digit);
}

if ( kkk>0 && kkk==18)
{
Start_Lot= NormalizeDouble(Lot19,Lot_Digit);
}

if ( kkk>0 && kkk==19)
{
Start_Lot= NormalizeDouble(Lot20,Lot_Digit);
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
if ( kkk>0 && kkk==21)
{
Start_Lot= NormalizeDouble(Lot22,Lot_Digit);
}

if ( kkk>0 && kkk==22)
{
Start_Lot= NormalizeDouble(Lot23,Lot_Digit);
}

if ( kkk>0 && kkk==23)
{
Start_Lot= NormalizeDouble(Lot24,Lot_Digit);
}

if ( kkk>0 && kkk==24)
{
Start_Lot= NormalizeDouble(Lot25,Lot_Digit);
}

if ( kkk>0 && kkk==25)
{
Start_Lot= NormalizeDouble(Lot26,Lot_Digit);
}

if ( kkk>0 && kkk==26)
{
Start_Lot= NormalizeDouble(Lot27,Lot_Digit);
}

if ( kkk>0 && kkk==27)
{
Start_Lot= NormalizeDouble(Lot28,Lot_Digit);
}

if ( kkk>0 && kkk==28)
{
Start_Lot= NormalizeDouble(Lot29,Lot_Digit);
}

if ( kkk>0 && kkk==29)
{
Start_Lot= NormalizeDouble(Lot30,Lot_Digit);
}

if ( kkk>0 && kkk==30)
{
Start_Lot= NormalizeDouble(Lot31,Lot_Digit);
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

if ( kkk>0 && kkk==31)
{
Start_Lot= NormalizeDouble(Lot32,Lot_Digit);
}

if ( kkk>0 && kkk==32)
{
Start_Lot= NormalizeDouble(Lot33,Lot_Digit);
}

if ( kkk>0 && kkk==33)
{
Start_Lot= NormalizeDouble(Lot34,Lot_Digit);
}

if ( kkk>0 && kkk==34)
{
Start_Lot= NormalizeDouble(Lot35,Lot_Digit);
}
if ( kkk>0 && kkk==35)
{
Start_Lot= NormalizeDouble(Lot36,Lot_Digit);
}

if ( kkk>0 && kkk==36)
{
Start_Lot= NormalizeDouble(Lot37,Lot_Digit);
}

if ( kkk>0 && kkk==37)
{
Start_Lot= NormalizeDouble(Lot38,Lot_Digit);
}

if ( kkk>0 && kkk==38)
{
Start_Lot= NormalizeDouble(Lot39,Lot_Digit);
}

if ( kkk>0 && kkk==39)
{
Start_Lot= NormalizeDouble(Lot40,Lot_Digit);
}

if ( kkk>0 && kkk==40)
{
Start_Lot= NormalizeDouble(Lot41,Lot_Digit);
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

if ( kkk>0 && kkk==41)
{
Start_Lot= NormalizeDouble(Lot42,Lot_Digit);
}

if ( kkk>0 && kkk==42)
{
Start_Lot= NormalizeDouble(Lot43,Lot_Digit);
}

if ( kkk>0 && kkk==43)
{
Start_Lot= NormalizeDouble(Lot44,Lot_Digit);
}

if ( kkk>0 && kkk==44)
{
Start_Lot= NormalizeDouble(Lot45,Lot_Digit);
}
if ( kkk>0 && kkk==45)
{
Start_Lot= NormalizeDouble(Lot46,Lot_Digit);
}

if ( kkk>0 && kkk==46)
{
Start_Lot= NormalizeDouble(Lot47,Lot_Digit);
}

if ( kkk>0 && kkk==47)
{
Start_Lot= NormalizeDouble(Lot48,Lot_Digit);
}

if ( kkk>0 && kkk==48)
{
Start_Lot= NormalizeDouble(Lot49,Lot_Digit);
}

if ( kkk>0 && kkk==49)
{
Start_Lot= NormalizeDouble(Lot50,Lot_Digit);
}

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
if ( kkk>0 && kkk==50)
{
Start_Lot= NormalizeDouble(Lot51,Lot_Digit);
}

if ( kkk>0 && kkk==51)
{
Start_Lot= NormalizeDouble(Lot52,Lot_Digit);
}

if ( kkk>0 && kkk==52)
{
Start_Lot= NormalizeDouble(Lot53,Lot_Digit);
}

if ( kkk>0 && kkk==53)
{
Start_Lot= NormalizeDouble(Lot54,Lot_Digit);
}

if ( kkk>0 && kkk==54)
{
Start_Lot= NormalizeDouble(Lot55,Lot_Digit);
}
if ( kkk>0 && kkk==55)
{
Start_Lot= NormalizeDouble(Lot56,Lot_Digit);
}

if ( kkk>0 && kkk==56)
{
Start_Lot= NormalizeDouble(Lot57,Lot_Digit);
}

if ( kkk>0 && kkk==57)
{
Start_Lot= NormalizeDouble(Lot58,Lot_Digit);
}

if ( kkk>0 && kkk==58)
{
Start_Lot= NormalizeDouble(Lot59,Lot_Digit);
}

if ( kkk>0 && kkk==59)
{
Start_Lot= NormalizeDouble(Lot60,Lot_Digit);
}

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
if ( kkk>0 && kkk==60)
{
Start_Lot= NormalizeDouble(Lot61,Lot_Digit);
}

if ( kkk>0 && kkk==61)
{
Start_Lot= NormalizeDouble(Lot62,Lot_Digit);
}

if ( kkk>0 && kkk==62)
{
Start_Lot= NormalizeDouble(Lot63,Lot_Digit);
}

if ( kkk>0 && kkk==63)
{
Start_Lot= NormalizeDouble(Lot64,Lot_Digit);
}

if ( kkk>0 && kkk==64)
{
Start_Lot= NormalizeDouble(Lot65,Lot_Digit);
}
if ( kkk>0 && kkk==65)
{
Start_Lot= NormalizeDouble(Lot66,Lot_Digit);
}

if ( kkk>0 && kkk==66)
{
Start_Lot= NormalizeDouble(Lot67,Lot_Digit);
}

if ( kkk>0 && kkk==67)
{
Start_Lot= NormalizeDouble(Lot68,Lot_Digit);
}

if ( kkk>0 && kkk==68)
{
Start_Lot= NormalizeDouble(Lot69,Lot_Digit);
}

if ( kkk>0 && kkk==70)
{
Start_Lot= NormalizeDouble(Lot71,Lot_Digit);
}

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

if ( kkk>0 && kkk==71)
{
Start_Lot= NormalizeDouble(Lot72,Lot_Digit);
}

if ( kkk>0 && kkk==72)
{
Start_Lot= NormalizeDouble(Lot73,Lot_Digit);
}

if ( kkk>0 && kkk==73)
{
Start_Lot= NormalizeDouble(Lot74,Lot_Digit);
}

if ( kkk>0 && kkk==74)
{
Start_Lot= NormalizeDouble(Lot75,Lot_Digit);
}
if ( kkk>0 && kkk==75)
{
Start_Lot= NormalizeDouble(Lot76,Lot_Digit);
}

if ( kkk>0 && kkk==76)
{
Start_Lot= NormalizeDouble(Lot77,Lot_Digit);
}

if ( kkk>0 && kkk==77)
{
Start_Lot= NormalizeDouble(Lot78,Lot_Digit);
}

if ( kkk>0 && kkk==78)
{
Start_Lot= NormalizeDouble(Lot79,Lot_Digit);
}

if ( kkk>0 && kkk==79)
{
Start_Lot= NormalizeDouble(Lot80,Lot_Digit);
}

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
if ( kkk>0 && kkk==80)
{
Start_Lot= NormalizeDouble(Lot81,Lot_Digit);
}

if ( kkk>0 && kkk==81)
{
Start_Lot= NormalizeDouble(Lot82,Lot_Digit);
}

if ( kkk>0 && kkk==82)
{
Start_Lot= NormalizeDouble(Lot83,Lot_Digit);
}

if ( kkk>0 && kkk==83)
{
Start_Lot= NormalizeDouble(Lot84,Lot_Digit);
}

if ( kkk>0 && kkk==84)
{
Start_Lot= NormalizeDouble(Lot85,Lot_Digit);
}
if ( kkk>0 && kkk==85)
{
Start_Lot= NormalizeDouble(Lot86,Lot_Digit);
}

if ( kkk>0 && kkk==86)
{
Start_Lot= NormalizeDouble(Lot87,Lot_Digit);
}

if ( kkk>0 && kkk==87)
{
Start_Lot= NormalizeDouble(Lot88,Lot_Digit);
}

if ( kkk>0 && kkk==88)
{
Start_Lot= NormalizeDouble(Lot89,Lot_Digit);
}

if ( kkk>0 && kkk==89)
{
Start_Lot= NormalizeDouble(Lot90,Lot_Digit);
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
if ( kkk>0 && kkk==90)
{
Start_Lot= NormalizeDouble(Lot91,Lot_Digit);
}

if ( kkk>0 && kkk==91)
{
Start_Lot= NormalizeDouble(Lot92,Lot_Digit);
}

if ( kkk>0 && kkk==92)
{
Start_Lot= NormalizeDouble(Lot93,Lot_Digit);
}

if ( kkk>0 && kkk==93)
{
Start_Lot= NormalizeDouble(Lot94,Lot_Digit);
}

if ( kkk>0 && kkk==94)
{
Start_Lot= NormalizeDouble(Lot95,Lot_Digit);
}
if ( kkk>0 && kkk==95)
{
Start_Lot= NormalizeDouble(Lot96,Lot_Digit);
}

if ( kkk>0 && kkk==96)
{
Start_Lot= NormalizeDouble(Lot97,Lot_Digit);
}

if ( kkk>0 && kkk==97)
{
Start_Lot= NormalizeDouble(Lot98,Lot_Digit);
}

if ( kkk>0 && kkk==98)
{
Start_Lot= NormalizeDouble(Lot99,Lot_Digit);
}

if ( kkk>0 && kkk==99)
{
Start_Lot= NormalizeDouble(Lot100,Lot_Digit);
}

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

if ( kkk<=0)  Start_Lot= Lot1;

return(Start_Lot);
}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||

bool Filter_Trial()
{
if(Filter_Time_For_Trial )
{

if ( Year()>=dyear && Month()>=dmonth)

{return true; }

else {return false;

}

}

return true;

}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
int string_window( string n, int X_Axis, int Y_Axis, int WindowToUse )
{
ObjectCreate( n, OBJ_LABEL, WindowToUse, 0, 0 );

ObjectSet( n, OBJPROP_CORNER, 0 );

ObjectSet( n, OBJPROP_XDISTANCE, X_Axis );
ObjectSet( n, OBJPROP_YDISTANCE, Y_Axis );
ObjectSet( n, OBJPROP_BACK, true );
return(0);
}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
void CleanUp()

ObjectDelete("SettingLot");

}
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM||
double pip; double Start_Lot,Lots;
datetime selisih_time,xy_time,tc,ts,to,diff_time;
double    C_HalfTrend_1,P_HalfTrend_1, C_HalfTrend_2,P_HalfTrend_2;
int xy_order;
double x_price,y_price;
input bool ACCOUNT_INFO=true;
string Day1="MONDAY";
string Day2="TUESDAY";
string Day3="WEDNESDAY";
string Day4="THURSDAY";
string Day5="FRIDAY";
string Day6="SATURDAY";
string Day7="SUNDAY";
//double RANGE;
string Running_Price,Range_Price,AB,AE,AP,SP,Leverage,hari;
input int text_size= 12;
input color color_text= White;
input int text_corner=1;
711

I am really not too good at coding.....
1575

I'm really sorry that I couldn't help in this matter as I'm not good at tracing others codes

because my coding style is completely different than yours.

Try to use more functions as much as you can by assigning little task for each function

and let the start( ) function works as director for the whole code by passing arguments

and receiving the returned values to make the code more easier to trace and develop.

I'm really sorry, I can't help :(

711

Osama Shaban:

I'm really sorry that I couldn't help in this matter as I'm not good at tracing others codes

because my coding style is completely different than yours.

Try to use more functions as much as you can by assigning little task for each function

and let the start( ) function works as director for the whole code by passing arguments

and receiving the returned values to make the code more easier to trace and develop.

I'm really sorry, I can't help :(

no problem. thank you for your help.
I will look into it.
711

How do I compile your code into a single EA?
I can use it on a separate chart.
problem solved.