Discussion of article "Library for easy and quick development of MetaTrader programs (part XXIV): Base trading class - auto correction of invalid parameters" - page 2

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, these two subroutines run differently, where "Statistical Time Period Buy Loss" can get the desired result, while "Statistical Time Period Sell Loss" results in 0, why is this?
//Statistical time period history of the loss of single (has been closed single) number, lasttime for the start of time
double statistics time period buy loss(int 魔号,string buyOrSell, string as_8,datetime lasttime)
{
double Volume=0; double buyOrSell=0; double buyOrSell=0; double buyOrSell=0
double buyOrSell=0; int totalOrSell=0; int buyOrSell=0
int TotalOrders=0; int buyOrSell=0; datetime lasttime
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic Number )// only count the current corresponding currency pairs
{
if (buyOrSell == "buy")
{
if (OrderType() == OP_BUY )
{
if (OrderCloseTime()>lasttime)
{
if (OrderProfit()<0)
{
TotalOrders=TotalOrders+1;
Loss=Loss+OrderProfit();
Volume=Volume+OrderLots();
}
}
}
}
}
}}
if (as_8 == "total number of orders") return (total number of orders);
if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss)
if (as_8 == "Volume") return (Volume); return (0.0); if (as_8 == "Loss") return (Loss); if (as_8 == "Volume") return (Volume)
return (0.0);
}
double Statistics Session Sell Loss(int 魔号,string buyOrSell, string as_8,datetime lasttime)
{
double Volume=0;
double Sell Loss = 0; int Total Orders = 0; datetime lasttime
int TotalOrders=0; int buyOrSell=0; datetime lasttime
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic Number )// only count the current corresponding currency pairs
{
if (buyOrSell == "sell")
{
if (OrderType() == OP_SELL )
{
if (OrderCloseTime()>lasttime)
{
if (OrderProfit()<0)
{
TotalOrders=TotalOrders+1;
Loss=Loss+OrderProfit();
Volume=Volume+OrderLots();
}
}
}
}
}
}}
if (as_8 == "total number of orders") return (total number of orders);
if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss)
if (as_8 == "Volume") return (Volume); return (0.0); if (as_8 == "Loss") return (Loss); if (as_8 == "Volume") return (Volume)
return (0.0);
}
Hi, these two subroutines run differently, where "Statistical Time Period Buy Loss" can get the desired result, while "Statistical Time Period Sell Loss" results in 0, why is this?
//Statistical time period history of the loss of single (has been closed single) number, lasttime for the start of time
double statistics time period buy loss(int 魔号,string buyOrSell, string as_8,datetime lasttime)
{
double Volume=0; double buyOrSell=0; double buyOrSell=0; double buyOrSell=0
double buyOrSell=0; int totalOrSell=0; int buyOrSell=0
int TotalOrders=0; int buyOrSell=0; datetime lasttime
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic Number )// only count the current corresponding currency pairs
{
if (buyOrSell == "buy")
{
if (OrderType() == OP_BUY )
{
if (OrderCloseTime()>lasttime)
{
if (OrderProfit()<0)
{
TotalOrders=TotalOrders+1;
Loss=Loss+OrderProfit();
Volume=Volume+OrderLots();
}
}
}
}
}
}}
if (as_8 == "total number of orders") return (total number of orders);
if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss)
if (as_8 == "Volume") return (Volume); return (0.0); if (as_8 == "Loss") return (Loss); if (as_8 == "Volume") return (Volume)
return (0.0);
}
double Statistics Session Sell Loss(int 魔号,string buyOrSell, string as_8,datetime lasttime)
{
double Volume=0;
double Sell Loss = 0; int Total Orders = 0; datetime lasttime
int TotalOrders=0; int buyOrSell=0; datetime lasttime
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic Number )// only count the current corresponding currency pairs
{
if (buyOrSell == "sell")
{
if (OrderType() == OP_SELL )
{
if (OrderCloseTime()>lasttime)
{
if (OrderProfit()<0)
{
TotalOrders=TotalOrders+1;
Loss=Loss+OrderProfit();
Volume=Volume+OrderLots();
}
}
}
}
}
}}
if (as_8 == "total number of orders") return (total number of orders);
if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss)
if (as_8 == "Volume") return (Volume); return (0.0); if (as_8 == "Loss") return (Loss); if (as_8 == "Volume") return (Volume)
return (0.0);
}
OK
Hi, these two subroutines run differently, where "Statistical Time Period Buy Loss" can get the desired result, while "Statistical Time Period Sell Loss" results in 0, why is this?
//Statistical time period history of the loss of single (has been closed single) number, lasttime for the start of time
double statistics time period buy loss(int 魔号,string buyOrSell, string as_8,datetime lasttime)
{
double Volume=0; double buyOrSell=0; double buyOrSell=0; double buyOrSell=0
double buyOrSell=0; int totalOrSell=0; int buyOrSell=0
int TotalOrders=0; int buyOrSell=0; datetime lasttime
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic Number )// only count the current corresponding currency pairs
{
if (buyOrSell == "buy")
{
if (OrderType() == OP_BUY )
{
if (OrderCloseTime()>lasttime)
{
if (OrderProfit()<0)
{
TotalOrders=TotalOrders+1;
Loss=Loss+OrderProfit();
Volume=Volume+OrderLots();
}
}
}
}
}
}}
if (as_8 == "total number of orders") return (total number of orders);
if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss)
if (as_8 == "Volume") return (Volume); return (0.0); if (as_8 == "Loss") return (Loss); if (as_8 == "Volume") return (Volume)
return (0.0);
}
double Statistics Session Sell Loss(int 魔号,string buyOrSell, string as_8,datetime lasttime)
{
double Volume=0;
double Sell Loss = 0; int Total Orders = 0; datetime lasttime
int TotalOrders=0; int buyOrSell=0; datetime lasttime
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic Number )// only count the current corresponding currency pairs
{
if (buyOrSell == "sell")
{
if (OrderType() == OP_SELL )
{
if (OrderCloseTime()>lasttime)
{
if (OrderProfit()<0)
{
TotalOrders=TotalOrders+1;
Loss=Loss+OrderProfit();
Volume=Volume+OrderLots();
}
}
}
}
}
}}
if (as_8 == "total number of orders") return (total number of orders);
if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss); if (as_8 == "Loss") return (Loss)
if (as_8 == "Volume") return (Volume); return (0.0); if (as_8 == "Loss") return (Loss); if (as_8 == "Volume") return (Volume)
return (0.0);
}
This is a discussion thread for the article, and not for resolving issues not related to the library described in the article.
To insert the code into the message, you need to use the Alt + S combination or this button.
Hello, does the programme not support the search of historical sell orders?
And even much more.
Hi, I've noticed that when loading a custom indicator and then deleting the custom indicator the buttons don't work and I can't get it to work. Why is this? How can I fix it?
During use - what?
Which keys do not work?I'd like to send you a custom indicator, you load it and delete it, try it and you'll understand.