Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese
No, no me refiero a lo que ya has escrito.
Dígame en palabras - cálculo de beneficios para las órdenes cerradas que le interesan
- diario
- con pérdidas
- último pedido
¿o algo más?
Describa la serie
Una serie de últimos pedidos cerrados "por ahora"
Serie de últimos pedidos cerrados "por ahora"
Es decir, necesita información sobre la serie de órdenes cerradas más recientemente, si lo he entendido bien.
Para aplicar este enfoque, primero debe rellenar la matriz de tickets de pedido en cada cierre exitoso y luego extraer la información de los pedidos cerrados en la forma que necesite
¿Puede hacerlo usted mismo?
Prueba con
return(LastProfit);Comment( LastProfitCL(-1, 0) );
//+----------------------------------------------------------------------------+
//| Возвращает суммарный профит в валюте депозита серии закрытых ордеров |
//+----------------------------------------------------------------------------+
double LastProfitCL(int op=-1, datetime t=0){ //"op" позиция (-1 любая позиция)
double LastProfit=0;
for(int i=OrdersHistoryTotal()-1;i>=0;i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) {
if((op<0||OrderType()==op) && OrderSymbol()==Symbol() && OrderMagicNumber()==magic){
if(t<=OrderCloseTime()) {
t=OrderCloseTime();
LastProfit+=OrderProfit()+OrderCommission()+OrderSwap();
}}}}
}
Prueba con
Comment( LastProfitCL(-1, 0) );
//+----------------------------------------------------------------------------+
//| Возвращает суммарный профит в валюте депозита серии закрытых ордеров |
//+----------------------------------------------------------------------------+
double LastProfitCL(int op=-1, datetime t=0){ //"op" позиция (-1 любая позиция)
double LastProfit=0;
for(int i=OrdersHistoryTotal()-1;i>=0;i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) {
if((op<0||OrderType()==op) && OrderSymbol()==Symbol() && OrderMagicNumber()==Magic){
if(t<=OrderCloseTime()) {
t=OrderCloseTime();
LastProfit+=OrderProfit()+OrderCommission()+OrderSwap();
}
}
}
}
return(LastProfit);
}
¿Y si no se cierra al mismo tiempo?
No es del todo correcto.
Y si se acuerda de ello al presentar la orden de cierre, entonces estará bien.
pero esta línea...
no es necesario.
Sacará el total de toda la serie
Pero la señora quiere información más detallada, según entendí en el primer post
¿Y si no se cierra al mismo tiempo?
Así que necesita información sobre la última serie de órdenes cerradas, si lo he entendido bien.
Para poner en práctica este enfoque, primero debe crear una matriz de tickets de órdenes al cierre exitoso y luego extraer la información de las órdenes cerradas
¿Puede hacerlo usted mismo?
Por favor, aconséjenos usar un ejemplo.
Es decir
¿Y luego comparar?
Será mejor que me des un ejemplo.
Es decir
¿Y luego comparar?
No hay problema.
Ahora lo único que queda por aclarar es cómo debe ser la información de las órdenes cerradas de la serie ?
¿Se trata de una transferencia o hay que dividir el importe entre + y -?
Existe un indicador para
i-Profit
Produce losbeneficios actuales de hoy, de la semana, del mes y del año.
Un ejemplo mejor sería
He aquí un ejemplo:
GlobalVariableSet(GetGlobalVariableName("LastProfit"), TimeCurrent()); // запомним время закрытия
// здесь код закрытия всех и сразу, нужен цикл, чтоб не выходил с функции до полного закрытия всех
}
El resto de la historia
//| Возвращает суммарный профит в валюте депозита серии закрытых позиций |
//+----------------------------------------------------------------------------+
double LastProfitCL(int op=-1, datetime t=0){ //"op" позиция (-1 любая позиция)
double LastProfit=0;
for(int i=OrdersHistoryTotal()-1;i>=0;i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) {
if((op<0||OrderType()==op) && OrderSymbol()==Symbol() && OrderMagicNumber()==Magic){
if(t<=OrderCloseTime()) {
t=OrderCloseTime();
LastProfit+=OrderProfit()+OrderCommission()+OrderSwap();
}}}}
return(LastProfit);
}
//===============================================================================================
//----------------------- Создает и возвращает имя глобальной переменной -----------------------+
//===============================================================================================
string GetGlobalVariableName(string name="", string symb="0") {
if(symb=="0") { symb=Symbol();}
if(!MQLInfoInteger(MQL_TESTER)) {
return(prefix+symb+"_"+(string)AccountInfoInteger(ACCOUNT_LOGIN)+"_"+MQLInfoString(MQL_PROGRAM_NAME)+"_"+name);
} else {
return(prefix+symb+"_"+(string)AccountInfoInteger(ACCOUNT_LOGIN)+"_"+MQLInfoString(MQL_PROGRAM_NAME)+"_tester"+"_"+name);
}}
Lo conseguimos incluso si reiniciamos el terminal
{
Comment( LastProfitCL(-1, (datetime)GlobalVariableGet(GetGlobalVariableName("LastProfit"))) );
}
Existe un indicador para
i-Profit
Produce losbeneficios actuales de hoy, de la semana, del mes y del año.