黄金交易策略(Nerve Nnife.mql4):1秒救地球的第六单

黄金交易策略(Nerve Nnife.mql4):1秒救地球的第六单_第1张图片

一轮趋势做单,正常情况是5单便可以完成一轮盈利。但当开仓后快速追加5单也无法止盈的话,我们得找准极其苛刻的条件开出第6单,并指望完成利润覆盖。代码如下:

if(count >= 5 && count < 10 && isDown(small_timeframe,offset,small_indicator) == UP)//6~10笔单执行海豹突击队  
         {
            //空间突破3%介入海做多
            int index = iHighest(Symbol(),small_timeframe,MODE_HIGH,3,1);
            double highPrice = iHigh(Symbol(), small_timeframe, index);
            index = iLowest(Symbol(),small_timeframe,MODE_LOW,3,1);
            double lowPrice = iLow(Symbol(), small_timeframe, index);
            bool upupup = false;
            if((Ask - highPrice)/(highPrice - lowPrice) > 0.03)//向上突破3%
              {
                upupup = true;
              }
            if (!follow  && !isCrazy2 && upupup && (lastPrice - Ask) / Point > order6_10_trigger &&  TimeCurrent() > nextOrderTime)//m15绿下降超500点,海豹突击队准备入场
            {
               double buyTotalLots = calcBuyOrSellTotalLots(crazy_unwind_interval, 500);//计算买入量
               if (buyTotalLots > 0.01)
               {
                  //买入多单
                  count ++; 
                  OrderSend(Symbol(),OP_BUY,buyTotalLots,MarketInfo(Symbol(),MODE_ASK),0,0,0,"" + count,888,0,clrBlue);
                  printfPro("大小趋势相同买入多单(海豹突击队)" + count); 
                  lastPrice = MarketInfo(Symbol(),MODE_ASK);
                  nextOrderTime = TimeCurrent() + open_time;
                  isCrazy2 = true;
               }
               
               
            }
            double totalProfit = calcTotalProfit(0, "buy", 888);
            if(isCrazy2 && !follow &&  totalProfit / Point > 500)
              {
               follow = true;
               followPrice = totalProfit;
              }
            if(follow)
              {
                followPrice = followPrice < totalProfit ? totalProfit : followPrice;
              }
            
            if (follow && (followPrice - totalProfit) / Point > crazy_interval)
            {
               //平仓解套获利
               Close_All_Order_DeadLine(Symbol(),"EA","B",888);
               printfPro("海豹突击队平仓解套获利");
               reset(crazy_close_all_open_time);
            }
            
         }

大致条件是:小趋势符合、空间突破符合。

 完整EA:Nerve Knife.ex4黄金交易策略_黄金趋势ea-CSDN博客

你可能感兴趣的:(量化交易EA,金融,c++)