Discussão do artigo "Biblioteca para criação simples e rápida de programas para MetaTrader (Parte XXIV): classe básica de negociação, correção automática de parâmetros errados" - página 2

 

Olá, essas duas sub-rotinas são executadas de forma diferente, onde "Statistical Time Period Buy Loss" pode obter o resultado desejado, enquanto "Statistical Time Period Sell Loss" resulta em 0, por que isso acontece?

//Histórico do período de tempo estatístico da perda de um único número (foi fechado um único), lasttime para o início do tempo

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

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 )// contar apenas os pares de moedas correspondentes atuais

{

if (buyOrSell == "buy")

{

se (OrderType() == OP_BUY )

{

se (OrderCloseTime()>lasttime)

{

se (OrderProfit()<0)

{

TotalOrders=TotalOrders+1;

Perda=Perda+OrderProfit();

Volume=Volume+OrderLots();

}

}

}

}


}

}}

if (as_8 == "número total de ordens") return (número total de ordens);

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 )// contar apenas os pares de moedas correspondentes atuais

{

if (buyOrSell == "sell")

{

if (OrderType() == OP_SELL )

{

if (OrderCloseTime()>lasttime)

{

if (OrderProfit()<0)

{

TotalOrders=TotalOrders+1;

Perda=Perda+OrderProfit();

Volume=Volume+OrderLots();

}

}

}

}

}

}}

if (as_8 == "número total de ordens") return (número total de ordens);

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);

}

 

Olá, essas duas sub-rotinas são executadas de forma diferente, onde "Statistical Time Period Buy Loss" pode obter o resultado desejado, enquanto "Statistical Time Period Sell Loss" resulta em 0, por que isso acontece?

//Histórico do período de tempo estatístico da perda de um único número (foi fechado um único), lasttime para o início do tempo

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

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 )// contar apenas os pares de moedas correspondentes atuais

{

if (buyOrSell == "buy")

{

se (OrderType() == OP_BUY )

{

se (OrderCloseTime()>lasttime)

{

se (OrderProfit()<0)

{

TotalOrders=TotalOrders+1;

Perda=Perda+OrderProfit();

Volume=Volume+OrderLots();

}

}

}

}


}

}}

if (as_8 == "número total de ordens") return (número total de ordens);

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 )// contar apenas os pares de moedas correspondentes atuais

{

if (buyOrSell == "sell")

{

if (OrderType() == OP_SELL )

{

if (OrderCloseTime()>lasttime)

{

if (OrderProfit()<0)

{

TotalOrders=TotalOrders+1;

Perda=Perda+OrderProfit();

Volume=Volume+OrderLots();

}

}

}

}

}

}}

if (as_8 == "número total de ordens") return (número total de ordens);

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);

}

 
Artyom Trishkin:
OK

Oi, essas duas sub-rotinas são executadas de forma diferente, onde "Statistical Time Period Buy Loss" pode obter o resultado desejado, enquanto "Statistical Time Period Sell Loss" resulta em 0, por que isso acontece?

//Histórico do período de tempo estatístico da perda de um único número (foi fechado um único), lasttime para o início do tempo

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

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 )// contar apenas os pares de moedas correspondentes atuais

{

if (buyOrSell == "buy")

{

se (OrderType() == OP_BUY )

{

se (OrderCloseTime()>lasttime)

{

se (OrderProfit()<0)

{

TotalOrders=TotalOrders+1;

Perda=Perda+OrderProfit();

Volume=Volume+OrderLots();

}

}

}

}


}

}}

if (as_8 == "número total de ordens") return (número total de ordens);

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 )// contar apenas os pares de moedas correspondentes atuais

{

if (buyOrSell == "sell")

{

if (OrderType() == OP_SELL )

{

if (OrderCloseTime()>lasttime)

{

if (OrderProfit()<0)

{

TotalOrders=TotalOrders+1;

Perda=Perda+OrderProfit();

Volume=Volume+OrderLots();

}

}

}

}

}

}}

if (as_8 == "número total de ordens") return (número total de ordens);

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);

}

 

Este é um tópico de discussão para o artigo, e não para resolver problemas não relacionados à biblioteca descrita no artigo.

Para inserir o código na mensagem, você precisa usar a combinação Alt + S ou este botão.


 
Olá, é possível que esse programa não ofereça suporte à pesquisa de ordens de venda negociadas no histórico?
 
hsyhsy863 :
Olá, o programa não suporta a pesquisa de ordens de venda históricas?

E muito mais.

 
Olá, notei que, ao carregar um indicador personalizado e depois excluí-lo, os botões não funcionam e não consigo fazer com que ele funcione. Por que isso acontece? Como posso consertar isso?
 
hsyhsy863 :
Olá, notei que, ao carregar um indicador personalizado e depois excluí-lo, os botões não funcionam e não consigo fazer com que ele funcione. Por que isso acontece? Como posso consertar isso?

Durante o uso - o quê?

Quais teclas não funcionam?
 
Gostaria de lhe enviar um indicador personalizado, você pode carregá-lo e excluí-lo. Experimente e verá.
Arquivos anexados:
jh720-03-3.ex4  214 kb
 
hsyhsy863:
Gostaria de lhe enviar um indicador personalizado, carregue-o e exclua-o. Experimente e você entenderá.
Olá, você encontrou o problema que mencionei?