ผู้คิดค้นไอเดีย — Collector, ผู้พัฒนา MQL5 โค้ด — barabashkakvn.
ระบบนี้จะทำการเทรดโดยใช้คำสั่ง Buy Limit และ Sell Limit ที่รอดำเนินการ และจะลบคำสั่งทั้งหมดพร้อมกับปิดสถานะที่เปิดอยู่ในเวลา 23:59 น.
การคำนวณราคาสำหรับคำสั่งที่รอดำเนินการ:
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);
}
}
ในกรณีนี้ หากมีคำสั่งที่รอดำเนินการหรือสถานะที่เปิดอยู่ในเวลา 23:59 น. คำสั่งจะถูกลบออกและสถานะจะถูกปิด:
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();
แนะนำให้ใช้ระบบนี้ในกราฟ H1:

ความคิดเห็น 0