• Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)

Bug anyBody Fix this code For me plz

john mith

New Member
Credits
0
When I am using "strict" mode (#property strict) in a EA to generate an ex4 file, I found this ex4 file has some problem: any body can Fix this Code For Me plz :)

double subLotSize()
{
double lot = MathCeil(AccountFreeMargin() * RiskPercent / 1000) / 100;
if(lot<MarketInfo(Symbol(),MODE_MINLOT))lot=MarketInfo(Symbol(),MODE_MINLOT);
if(lot>MarketInfo(Symbol(),MODE_MAXLOT))lot=MarketInfo(Symbol(),MODE_MAXLOT);

return (NormalizeDouble(lot,Lot_Digits));
}
double profit(int type){
double c;
for(int i=0;i<OrdersTotal();i++){
bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol()&&OrderType()==type&&OrderMagicNumber()==MagicNumber){
c=c+OrderProfit();
}
}
return(c);
}
double AvTP(int type){
double Price;double lots;
for(int i=0;i<=OrdersTotal();i++){
bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&OrderType()==type){
Price+=OrderOpenPrice()*OrderLots();
lots+=OrderLots();
}
}
if(Price!=0&&lots!=0) return(Price/lots);
return(0);
}
//+---------------------------------------------------------------------------------+
Untitled__2.jpg
 
return (NormalizeDouble(lot,MarketInfo(Symbol(),MODE_DIGITS)));

and

double c=0;
double Price=0;double lots=0;
 
Back
Top