Altarius RSI随机指标:MetaTrader 5的交易专家

Mike 2017.03.02 18:51 10 0 0
附件

这款EA(系统交易)使用了两个iStochastic(随机振荡器)指标和一个iRSI(相对强弱指数)指标。

创意作者cxa, MQL5代码作者barabashkakvn.

此系统根据以往交易的分析来计算最佳的手数:

//+------------------------------------------------------------------+
//| 计算最佳手数 |
//+------------------------------------------------------------------+
double LotsOptimized()
  {
   double lot=Lots;
   int    losses=0;                  // 连续亏损的交易数量
//--- 选择手数
   lot=NormalizeDouble(m_account.FreeMargin()*MaximumRisk/1000.0,2);
//--- 计算连续亏损的交易数量
   if(DecreaseFactor>0)
     {
      //--- 请求交易历史
      HistorySelect(TimeCurrent()-86400,TimeCurrent()+86400);
      //---
      uint     total=HistoryDealsTotal();
      //--- 遍历所有交易
      for(uint i=0;i<total;i++)
        {
         if(!m_deal.SelectByIndex(i))
           {
            Print("历史错误!");
            break;
           }
         if(m_deal.Symbol()!=Symbol() || m_deal.Entry()!=DEAL_ENTRY_OUT)
            continue;
         //---
         if(m_deal.Profit()>0)
            break;
         if(m_deal.Profit()<0)
            losses++;
        }
      if(losses>1)
         lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
     }
//--- 返回手数
   if(lot<0.1)
      lot=0.1;
   return(lot);
  }

在EURUSD和USDJPY的回测结果:

Altarius RSI Stohastic USDJPY, H1 

Altarius RSI Stohastic EURUSD,H1 

Altarius RSI Stohastic USDJPY,M15 

Altarius RSI Stohastic EURUSD,M15 

列表
评论 0