Autor da ideia — Collector, autor do código MQL5 — barabashkakvn.
O Stoch é uma ferramenta que realiza operações utilizando ordens pendentes de Sell Limit e Buy Limit. Ele remove todas as ordens e fecha posições às 23:59.
Como Funcionam os Cálculos para Ordens Pendentes
A lógica de preços para as ordens pendentes é bem simples:
double temp_h=iHigh(1);
double temp_l=iLow(1);
double temp_c=iClose(1);
double H4,L4;
H4 = (((temp_h - temp_l)*1.1) / 2.0) + temp_c;
L4 = temp_c - ((temp_h - temp_l)*1.1) / 2.0;
//---
if(db!=str1.day_of_week && s==0)
{
if(!m_trade.SellLimit(Lots,H4,Symbol(),
H4+ExtStopLoss*Point(),
H4-ExtTakeProfit*Point(),0,0,"H4"))
GlobalVariableSet("SELLLIMIT",0);
else
{
GlobalVariableSet("SELLLIMIT",1);
GlobalVariableSet("DateS",str1.day_of_week);
}
}
//----
if(db!=str1.day_of_week && b==0)
{
if(!m_trade.BuyLimit(Lots,L4,Symbol(),
L4-ExtStopLoss*Point(),
L4+ExtTakeProfit*Point(),0,0,"L4"))
GlobalVariableSet("BUYLIMIT",0);
else
{
GlobalVariableSet("BUYLIMIT",1);
GlobalVariableSet("DateB",str1.day_of_week);
}
}
double temp_l=iLow(1);
double temp_c=iClose(1);
double H4,L4;
H4 = (((temp_h - temp_l)*1.1) / 2.0) + temp_c;
L4 = temp_c - ((temp_h - temp_l)*1.1) / 2.0;
//---
if(db!=str1.day_of_week && s==0)
{
if(!m_trade.SellLimit(Lots,H4,Symbol(),
H4+ExtStopLoss*Point(),
H4-ExtTakeProfit*Point(),0,0,"H4"))
GlobalVariableSet("SELLLIMIT",0);
else
{
GlobalVariableSet("SELLLIMIT",1);
GlobalVariableSet("DateS",str1.day_of_week);
}
}
//----
if(db!=str1.day_of_week && b==0)
{
if(!m_trade.BuyLimit(Lots,L4,Symbol(),
L4-ExtStopLoss*Point(),
L4+ExtTakeProfit*Point(),0,0,"L4"))
GlobalVariableSet("BUYLIMIT",0);
else
{
GlobalVariableSet("BUYLIMIT",1);
GlobalVariableSet("DateB",str1.day_of_week);
}
}
Remoção de Ordens e Fechamento de Posições
Se existirem ordens pendentes ou posições abertas às 23:59, o sistema automaticamente as exclui e fecha as posições:
if(total_pos>0 && str1.hour==23 && str1.min==59)
DeleteAllPositions();
if(total_orders>0 && str1.hour==23 && str1.min==59)
DeleteAllOrders();
DeleteAllPositions();
if(total_orders>0 && str1.hour==23 && str1.min==59)
DeleteAllOrders();
Dicas de Uso
Recomendamos utilizar este sistema no gráfico H1 para melhores resultados.

Comentário 0