有您的持续关注
我们会做得更好

操盘手EA dealers_trade_v_7.51_rivot



操盘手交易 v 7.51 RIVOT 是基于多手数剥头皮算法的 EA。该 EA 已经在实盘账户里反复测试过。
开仓方向的选择根据 RIVOT 的指标线, 它已经与 EA 集成到一起。如果价格高于 RIVOT 指标线, 则买入。如果低于, 相应地, 卖出。之后, EA 持续开仓, 每次都是大于之前的 1.5 或 2 倍。在设置里选择参数。开仓间隔为点数, 可在 EA 参数里设置。当最后最大交易量的仓位达到正面结果 (以止盈或尾随停止平仓), 整体订单批量平仓, 无论以前的开仓盈利与否。(此段描述乃引用说明,未经实盘证实。)

本网收集整理智能交易EA仅为MQL4编程爱好者提供语法及相关编程技巧的学习研究之用,智能交易存在极高的风险测试请用模拟盘,请勿用于实盘。dealers_trade_v_7.51_rivot EA源码:

//+------------------------------------------------------------------+
//|                                  dealers_trade_v_7.51_rivot.mq4  |
//|                                          copyright @2006, Alex_N |
//+------------------------------------------------------------------+ 
#property copyright "Copyright @2006, Alex_N"
#property link "http://www.125808047.com/"
#include <stdlib.mqh>

extern int    MAGIC=89562314;
extern double Lots = 0.1;
extern double StopLoss = 900;
extern double TakeProfit = 150;
extern double TrailingStop = 150;

extern double MaxTrades = 5;
extern double Pips = 4;
extern double SecureProfit = 50;
extern double AccountProtection = 1;
extern double OrderstoProtect = 3;
extern double ReverseCondition = 0;

extern double USDCHFPipValue=10.5;     
extern double USDCADPipValue=10.4;     
extern double USDJPYPipValue=9.2;      
extern double EURJPYPipValue=9.8;      
extern double EURUSDPipValue=10.3;    
extern double GBPUSDPipValue=10;       
extern double AUDUSDPipValue=9.9;     
extern double NZDUSDPipValue=8.9;     

extern double mm = 0;
extern double risk = 2;
extern int MaxLots=5;                 
extern double Doble=1.5;              
extern double AccountisNormal = 0;
extern double TimeZoneofData = 0;
extern double slippage = 2;


double OpenOrders = 0;
int cnt = 0;
double sl = 0;
double tp = 0;
double BuyPrice = 0;
double SellPrice = 0;
double lotsi = 0;
double mylotsi = 0;
double mode = 0;
double MyOrderType=0;
bool ContinueOpening = True;
double LastPrice = 0;
double PreviousOpenOrders = 0;
double Profit = 0;
double LastTicket = 0;
double LastType = 0;
double LastClosePrice = 0;
double LastLots = 0;
double Pivot = 0;
double PipValue = 0;
bool Reversed = False;
bool   cg = False;
double myl = 0;
double myh = 0;
double myC = 0;
double myO = 0;
double mypivot = 0;
double Today = 0;
double RefDate = 0;
double LastBarOfDay = 0;
double FirstBarOfDay = 0;
double Loop = 0;
double myyh = 0;
double myyl = 0;
double myyc = 0;
double p = 0;
double flp = 0;
double feh = 0;
double fel = 0;
double ph = 0;
double pl = 0;
double gap = 0;

int init()
{
   return(0);
}

void deinit() {
   Comment("www.125808047.com");
}

int start()
{

if( AccountisNormal == 1 ) {
   if( mm != 0 ) lotsi = MathCeil(AccountBalance() * risk / 10000) ; else lotsi = Lots;
}
else {
   if( mm != 0 ) lotsi = MathCeil(AccountBalance() * risk / 10000) / 10 ; else lotsi = Lots;
}

if( lotsi > MaxLots ) lotsi = MaxLots;

OpenOrders = 0;
for( cnt = 0; cnt < OrdersTotal(); cnt++ ) {
   cg = OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
   if( OrderSymbol() ==  Symbol()  && OrderMagicNumber()==MAGIC) OpenOrders++;
}
myh = High[0];
myl = Low[0];
myC = Close[0];
myO = Open[0];
myyh = High[1];
myyl = Low[1];
myyc = Close[1];
p  = (myyh + myyl + myyc + myO) / 4;
ph = (myyh + myh + myyc + myO) / 4;
pl = (myyl + myl + myyc + myO) / 4;
flp = (myh + myl + myC) / 3;
gap = MathAbs(p - flp) / Point;





   PipValue = 5;
   if (Symbol()== "USDCHF")  PipValue=USDCHFPipValue;
   if (Symbol()== "USDCAD")  PipValue=USDCADPipValue;
   if (Symbol()== "USDJPY")  PipValue=USDJPYPipValue;
   if (Symbol()== "EURJPY")  PipValue=EURJPYPipValue;
   if (Symbol()== "EURUSD")  PipValue=EURUSDPipValue;
   if (Symbol()== "GBPUSD")  PipValue=GBPUSDPipValue;
   if (Symbol()== "AUDUSD")  PipValue=AUDUSDPipValue;
   if (Symbol()== "NZDUSD")  PipValue=NZDUSDPipValue;
      
if( PreviousOpenOrders > OpenOrders ) {
   for( cnt = OrdersTotal()-1; cnt >= 0; cnt-- ) {
      cg = OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if( OrderSymbol() == Symbol()  && OrderMagicNumber()==MAGIC) {
         mode = OrderType();
         if( mode ==  OP_BUY )  cg = OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Blue);
         if( mode ==  OP_SELL ) cg = OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Red);
         return(0);
      }
   }
}

PreviousOpenOrders = OpenOrders;
if( OpenOrders >= MaxTrades ) ContinueOpening = False ; else ContinueOpening = True;

if( LastPrice == 0 ) {
   for( cnt = 0; cnt < OrdersTotal(); cnt++ ) {
      cg = OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if( OrderSymbol() == Symbol()  && OrderMagicNumber()==MAGIC) {
         LastPrice = OrderOpenPrice();
         if(OrderType()==OP_BUY)  MyOrderType=2;
         if(OrderType()==OP_SELL)  MyOrderType=1;
      }
   }
}

if( OpenOrders < 1 ) MyOrderType=0;
if( OpenOrders < 1 && Bid < p && Bid < flp && gap >= 7 ) {
   LastPrice = 0;
   MyOrderType=1;
}
if( OpenOrders < 1 && Ask > p && Ask > flp && gap >= 7 ) {
   LastPrice = 0;
   MyOrderType=2;
}

for( cnt = OrdersTotal()-1; cnt >= 0; cnt-- ) {
   cg = OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
   if( OrderSymbol() == Symbol() && OrderMagicNumber()==MAGIC && Reversed == False ) {
      if( OrderType() ==  OP_SELL ) {
         if( TrailingStop > 0 ) {
            if( OrderOpenPrice() - Ask >= TrailingStop * Point + Pips * Point ) {
               if( OrderStopLoss() > Ask + Point * TrailingStop || OrderStopLoss() ==  0 ) {
                  cg = OrderModify(OrderTicket(),OrderOpenPrice(),Ask + Point * TrailingStop,
                  OrderClosePrice() - TakeProfit * Point - TrailingStop * Point,0,Purple);
                  return(0);
               }
            }
         }
      }
      if( OrderType() == OP_BUY ) {
         if( TrailingStop > 0 ) {
            if( Bid - OrderOpenPrice() >= TrailingStop * Point + Pips * Point ) {
               if( OrderStopLoss() < Bid - Point * TrailingStop ) {
                  cg = OrderModify(OrderTicket(),OrderOpenPrice(),Bid - Point * TrailingStop,
                  OrderClosePrice() + TakeProfit * Point + TrailingStop * Point,0,Yellow);
                  return(0);
               }
            }
         }
      }
   }
}

Profit = 0;
LastTicket = 0;
LastType = 0;
LastClosePrice = 0;
LastLots = 0;

for( cnt = 0; cnt < OrdersTotal(); cnt++ ) {
   cg = OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
   if( OrderSymbol() == Symbol()  && OrderMagicNumber()==MAGIC) {
      LastTicket = OrderTicket();
      if( OrderType() ==  OP_BUY ) LastType = 0;
      if( OrderType() ==  OP_SELL ) LastType = 1;
      LastClosePrice = OrderClosePrice();
      LastLots = OrderLots();
      if( LastType == 0 ) {
         if( OrderClosePrice() < OrderOpenPrice() ) {
            Profit = Profit - (OrderOpenPrice() - OrderClosePrice()) * OrderLots() / Point;
         }
         if( OrderClosePrice() > OrderOpenPrice() ) {
            Profit = Profit + (OrderClosePrice() - OrderOpenPrice()) * OrderLots() / Point;
         }
      }
      if( LastType == 1 ) {
         if( OrderClosePrice() > OrderOpenPrice() ) {
            Profit = Profit - (OrderClosePrice() - OrderOpenPrice()) * OrderLots() / Point;
         }
         if( OrderClosePrice() < OrderOpenPrice() ) {
            Profit = Profit + (OrderOpenPrice() - OrderClosePrice()) * OrderLots() / Point;
         }
      }
   }
}

Profit = Profit * PipValue;
if( OpenOrders >= MaxTrades - OrderstoProtect && AccountProtection ==  1 ) {
   if( MyOrderType == 2 && Bid == tp ) {
      cg = OrderClose(LastTicket,LastLots,LastClosePrice,slippage,Yellow);
      ContinueOpening = False;
      return(0);
   }
   if( MyOrderType == 1 && Ask == tp ) {
      cg = OrderClose(LastTicket,LastLots,LastClosePrice,slippage,Yellow);
      ContinueOpening = False;
      return(0);
   }
}

if( MyOrderType == 1 && ContinueOpening ) {
   if( Bid - LastPrice >= Pips * Point || OpenOrders < 1 ) {
      SellPrice = Bid;
      LastPrice = 0;
      if( TakeProfit ==  0 ) tp = 0 ; else tp = SellPrice - TakeProfit * Point;
      if( StopLoss ==  0 ) sl = 0 ; else sl = SellPrice + StopLoss * Point;
      if( OpenOrders != 0 ) {
         mylotsi = lotsi;
         for(cnt =0;cnt <OpenOrders;cnt ++) {
            if( MaxTrades > 12 ) mylotsi = NormalizeDouble(mylotsi * Doble,1) ; else mylotsi = NormalizeDouble(mylotsi * Doble,1);
         }
      }
      else {
         mylotsi = lotsi;
      }
      if( mylotsi > MaxLots ) mylotsi = MaxLots;
      cg = OrderSend(Symbol(),OP_SELL,mylotsi,SellPrice,slippage,sl,tp,NULL,MAGIC,0,Red);
      return(0);
   }
}

if( MyOrderType == 2 && ContinueOpening ) {
   if( LastPrice - Ask >= Pips * Point || OpenOrders < 1 ) {
      BuyPrice = Ask;
      LastPrice = 0;
      if( TakeProfit ==  0 ) tp = 0 ; else tp = BuyPrice + TakeProfit * Point;
      if( StopLoss ==  0 ) sl = 0 ; else sl = BuyPrice - StopLoss * Point;
      if( OpenOrders != 0 ) {
         mylotsi = lotsi;
         for(cnt =0;cnt <OpenOrders;cnt ++) {
            if( MaxTrades > 12 ) mylotsi = NormalizeDouble(mylotsi * Doble,1) ; else mylotsi = NormalizeDouble(mylotsi * Doble,1);
         }
      }
      else {
         mylotsi = lotsi;
      }
      if( mylotsi > MaxLots ) mylotsi = MaxLots;
      cg = OrderSend(Symbol(),OP_BUY,mylotsi,BuyPrice,slippage,sl,tp,NULL,MAGIC,0,Blue);
      return(0);
   }
}

return(0);
}

如您喜欢此文章请点下面分享按钮↴峰汇在线 » 操盘手EA dealers_trade_v_7.51_rivot
上一篇:
下一篇:
分享到:更多 ()