查看: 3128|回复: 35

逢亏加倍

[复制链接]

10

主题

33

回帖

112

积分

积分
112
发表于 2009-7-12 10:07:21 | 显示全部楼层 |阅读模式
我在网上找了一圈,逢亏加倍的思路有,但是就是没有看见ea的源码
这个思路应该很好的,虽然免不了爆仓,但是确实是一个ea的研究方向

各位高手给个源码,我来改进:
谢谢了!

17

主题

219

回帖

720

积分

积分
720
发表于 2013-7-15 20:47:24 | 显示全部楼层
看帖,顶贴,挣小钻,图开心。

2

主题

83

回帖

177

积分

积分
177
发表于 2009-7-12 13:05:06 | 显示全部楼层
丁丁看丁丁看丁丁看

130

主题

3408

回帖

1万

积分

EA策略研究家

积分
12346

周年纪念水鬼混世魔王暴发户正式会员

发表于 2009-7-12 15:28:57 | 显示全部楼层
《垃圾桶》多的是
好学就不要做懒惰虫
柒侠伍义_李易俸
编写EA课程,代编写(付费)
https://shop34551999.world.taobao.com
http://liithong.com/
http://mt4ea.com
http://mt5ea.com

7

主题

89

回帖

179

积分

积分
179
发表于 2009-7-12 15:30:07 | 显示全部楼层
侠大就是一个论断,不要做懒虫:14(

130

主题

3408

回帖

1万

积分

EA策略研究家

积分
12346

周年纪念水鬼混世魔王暴发户正式会员

发表于 2009-7-13 04:06:43 | 显示全部楼层
有了圣杯之后,你才有资格当懒惰虫

试一试,找一找 10point3 ea
柒侠伍义_李易俸
编写EA课程,代编写(付费)
https://shop34551999.world.taobao.com
http://liithong.com/
http://mt4ea.com
http://mt5ea.com

3

主题

45

回帖

153

积分

积分
153
发表于 2009-7-13 16:23:06 | 显示全部楼层
這樣不會一次虧太多嗎 ??
加倍是在買機會嗎  ?

10

主题

33

回帖

112

积分

积分
112
 楼主| 发表于 2009-7-13 16:30:39 | 显示全部楼层
5# 柒侠伍义


可惜了,没有搜到老大说的ea

5

主题

213

回帖

620

积分

积分
620
QQ
发表于 2009-7-17 16:09:45 | 显示全部楼层
我也没有搜到,请柒侠伍义版主给个10point3 ea的链接。谢谢

130

主题

3408

回帖

1万

积分

EA策略研究家

积分
12346

周年纪念水鬼混世魔王暴发户正式会员

发表于 2009-7-18 02:18:14 | 显示全部楼层
  1. //+------------------------------------------------------------------+
  2. //|                                                   10 points 3.mq4 |
  3. //|                              Copyright ?2005, Alejandro Galindo |
  4. //|                                              [url]http://elCactus.com[/url] |
  5. //+------------------------------------------------------------------+
  6. #property copyright "Copyright ?2005, Alejandro Galindo"
  7. #property link      "http://elCactus.com"
  8. //----
  9. extern double TakeProfit = 10;
  10. extern double Lots = 1.2;
  11. extern double InitialStop = 110;
  12. extern double TrailingStop = 10;
  13. //----
  14. extern int MaxTrades = 12;
  15. extern int Pips = 15;
  16. extern int SecureProfit = 10;
  17. extern int AccountProtection = 1;
  18. extern int OrderstoProtect = 6;
  19. extern int ReverseCondition = 261;
  20. extern double EURUSDPipValue = 40;
  21. extern double GBPUSDPipValue = 10;
  22. extern double USDCHFPipValue = 10;
  23. extern double USDJPYPipValue = 9.715;
  24. extern int StartYear = 2005;
  25. extern int StartMonth = 1;
  26. extern int EndYear = 2009;
  27. extern int EndMonth = 12;
  28. extern int EndHour = 22;
  29. extern int EndMinute = 30;
  30. extern int mm = 0;
  31. extern int risk = 12;
  32. extern int AccountisNormal = 0;
  33. //----
  34. int  OpenOrders = 0, cnt = 0;
  35. int  slippage = 5;
  36. double sl = 0, tp = 0;
  37. double BuyPrice = 0, SellPrice = 0;
  38. double lotsi = 0, mylotsi = 0;
  39. int mode = 0, myOrderType = 0;
  40. bool ContinueOpening = True;
  41. double LastPrice = 0;
  42. int  PreviousOpenOrders = 0;
  43. double Profit = 0;
  44. int LastTicket = 0, LastType = 0;
  45. double LastClosePrice = 0, LastLots = 0;
  46. double Pivot = 0;
  47. double PipValue = 0;
  48. string text = "", text2 = "";
  49. //+------------------------------------------------------------------+
  50. //| expert initialization function                                   |
  51. //+------------------------------------------------------------------+
  52. int init()
  53.   {
  54. //----
  55.    return(0);
  56.   }
  57. //+------------------------------------------------------------------+
  58. //| expert deinitialization function                                 |
  59. //+------------------------------------------------------------------+
  60. int deinit()
  61.   {
  62. //----
  63.    return(0);
  64.   }
  65. //+------------------------------------------------------------------+
  66. //| expert start function                                            |
  67. //+------------------------------------------------------------------+
  68. int start()
  69.   {
  70. //----
  71.    if(AccountisNormal == 1)
  72.               if(mm != 0)
  73.                   lotsi = MathCeil(AccountBalance()*risk / 10000);
  74.                      else
  75.                          lotsi = Lots;
  76.    else
  77.        // then is mini
  78.        if(mm != 0)
  79.            lotsi = MathCeil(AccountBalance()*risk / 10000) / 10;
  80.                      else
  81.                          lotsi = Lots;
  82. //----
  83.    if(lotsi > 100)
  84.        lotsi = 100;
  85.    OpenOrders = 0;
  86. //----
  87.    for(cnt = 0; cnt < OrdersTotal(); cnt++)   
  88.      {
  89.        OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
  90.               if(OrderSymbol() == Symbol())
  91.                          OpenOrders++;
  92.      }     
  93. //----
  94.    if(OpenOrders < 1)
  95.      {
  96.               if(TimeYear(CurTime()) < StartYear)
  97.                   return(0);  
  98.               //----
  99.        if(TimeMonth(CurTime()) < StartMonth)
  100.                   return(0);
  101.               //----
  102.        if(TimeYear(CurTime()) > EndYear)
  103.                   return(0);
  104.               //----
  105.        if(TimeMonth(CurTime()) > EndMonth )
  106.                   return(0);
  107.      }
  108. //----
  109.    if(Symbol() == "EURUSD")
  110.        PipValue = EURUSDPipValue;
  111. //----
  112.    if(Symbol() == "GBPUSD")
  113.        PipValue = GBPUSDPipValue;
  114. //----
  115.    if(Symbol() == "USDJPY")
  116.        PipValue = USDJPYPipValue;
  117. //----
  118.    if(Symbol() == "USDCHF")
  119.        PipValue = USDCHFPipValue;
  120. //----
  121.    if(PipValue == 0)
  122.        PipValue = 5;
  123. //----
  124.    if(PreviousOpenOrders > OpenOrders)
  125.      {          
  126.               for(cnt=OrdersTotal();cnt>=0;cnt--)
  127.                 {
  128.                   OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
  129.                          mode = OrderType();
  130.                          //----
  131.            if(OrderSymbol() == Symbol())
  132.                            {
  133.                                     if(mode == OP_BUY)
  134.                                         OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), slippage, Blue);
  135.                                     //----
  136.                if(mode == OP_SELL)
  137.                                         OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), slippage, Red);
  138.                                     return(0);
  139.                            }
  140.                 }
  141.      }
  142.    PreviousOpenOrders = OpenOrders;
  143. //----
  144.    if(OpenOrders >= MaxTrades)
  145.               ContinueOpening = False;
  146.    else
  147.               ContinueOpening = True;
  148. //----
  149.    if(LastPrice == 0)
  150.      {
  151.               for(cnt = 0; cnt < OrdersTotal(); cnt++)
  152.                 {       
  153.                   OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
  154.                          mode = OrderType();       
  155.                          //----
  156.            if(OrderSymbol() == Symbol())
  157.                            {
  158.                                     LastPrice = OrderOpenPrice();
  159.                                     //----
  160.                if(mode == OP_BUY)
  161.                                         myOrderType = 2;
  162.                                     //----
  163.                if(mode == OP_SELL)
  164.                                         myOrderType=1;       
  165.                            }
  166.                 }
  167.      }
  168. //----
  169.    if(OpenOrders < 1)
  170.      {
  171.               myOrderType = 3;
  172.               //----
  173.        if(iMACD(NULL, 0, 14, 26, 9, PRICE_CLOSE, MODE_MAIN,1) >
  174.                  iMACD(NULL, 0, 14, 26, 9, PRICE_CLOSE, MODE_MAIN, 2))
  175.                   myOrderType = 2;
  176.               //----
  177.        if(iMACD(NULL, 0, 14, 26, 9, PRICE_CLOSE, MODE_MAIN, 1) <
  178.                  iMACD(NULL, 0, 14, 26, 9, PRICE_CLOSE, MODE_MAIN, 2))
  179.                   myOrderType=1;
  180.               //----
  181.        if(ReverseCondition == 1)
  182.                          if(myOrderType == 1)
  183.                              myOrderType = 2;
  184.                          else
  185.                              if(myOrderType == 2)
  186.                                  myOrderType = 1;
  187.      }
  188.    // if we have opened positions we take care of them
  189.    for(cnt = OrdersTotal(); cnt >= 0; cnt--)
  190.      {
  191.        OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
  192.               //----
  193.        if(OrderSymbol() == Symbol())
  194.                 {       
  195.                          if(OrderType() == OP_SELL)
  196.                                     if(TrailingStop > 0)
  197.                                                if(OrderOpenPrice() - Ask >= (TrailingStop + Pips)*Point)                
  198.                                                           if(OrderStopLoss() > (Ask + Point*TrailingStop))
  199.                                                             {                       
  200.                                                               OrderModify(OrderTicket(), OrderOpenPrice(),
  201.                                                                           Ask + Point*TrailingStop,
  202.                                                                     OrderClosePrice() - TakeProfit*Point - TrailingStop*Point,
  203.                                                                           800, Purple);
  204.                                                                      return(0);                                                 
  205.                                                             }
  206.                          //----
  207.            if(OrderType() == OP_BUY)
  208.                                     if(TrailingStop > 0)
  209.                                         if(Bid - OrderOpenPrice() >= (TrailingStop + Pips)*Point)
  210.                                                           if(OrderStopLoss() < (Bid - Point*TrailingStop))
  211.                                                             {                                          
  212.                                                               OrderModify(OrderTicket(), OrderOpenPrice(),
  213.                                                                           Bid - Point*TrailingStop,
  214.                                                                        OrderClosePrice() + TakeProfit*Point + TrailingStop*Point,
  215.                                                                           800, Yellow);
  216.                            return(0);
  217.                                                             }
  218.                 }
  219.      }
  220.    Profit = 0;
  221.    LastTicket = 0;
  222.    LastType = 0;
  223.           LastClosePrice = 0;
  224.           LastLots = 0;       
  225. //----
  226.           for(cnt = 0; cnt < OrdersTotal(); cnt++)
  227.             {
  228.               OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
  229.               //----
  230.        if(OrderSymbol() == Symbol())
  231.                 {                       
  232.                          LastTicket = OrderTicket();
  233.                                 //----
  234.            if(OrderType() == OP_BUY)
  235.                                     LastType = OP_BUY;
  236.                                 //----
  237.            if(OrderType() == OP_SELL)
  238.                                     LastType = OP_SELL;
  239.                                 LastClosePrice = OrderClosePrice();
  240.                                 LastLots = OrderLots();
  241.                                 //----
  242.            if(LastType == OP_BUY)
  243.                                   {                       
  244.                                            if(OrderClosePrice() < OrderOpenPrice())
  245.                                                       Profit = Profit - (OrderOpenPrice() - OrderClosePrice())*OrderLots() / Point;
  246.                                            //----
  247.                if(OrderClosePrice() > OrderOpenPrice())
  248.                                                       Profit = Profit + (OrderClosePrice() - OrderOpenPrice())*OrderLots() / Point;
  249.                                   }
  250.                                 //----
  251.            if(LastType == OP_SELL)
  252.                            {
  253.                                     if(OrderClosePrice() > OrderOpenPrice())
  254.                                                Profit=Profit - (OrderClosePrice() - OrderOpenPrice())*OrderLots() / Point;
  255.                                     //----
  256.                if(OrderClosePrice() < OrderOpenPrice())
  257.                                                Profit=Profit+(OrderOpenPrice()-OrderClosePrice())*OrderLots()/Point;
  258.                            }
  259.                 }
  260.      }
  261.           Profit = Profit*PipValue;
  262.           text2 = "Profit: $" + DoubleToStr(Profit, 2) + " +/-";
  263. //----
  264.    if(OpenOrders >= (MaxTrades - OrderstoProtect) && AccountProtection == 1)
  265.      {            
  266.               if(Profit >= SecureProfit)
  267.                 {
  268.                   OrderClose(LastTicket, LastLots, LastClosePrice, slippage, Yellow);                 
  269.                   ContinueOpening = False;
  270.                   return(0);
  271.                 }
  272.      }
  273. //----
  274.    if(!IsTesting())
  275.      {
  276.               if(myOrderType == 3)
  277.                   text = "No conditions to open trades";
  278.               else
  279.                   text="                         ";
  280.               Comment("LastPrice=", LastPrice, " Previous open orders=", PreviousOpenOrders,
  281.                       "\nContinue opening=", ContinueOpening, " OrderType=", myOrderType, "\n",
  282.                       text2, "\nLots=", lotsi, "\n", text);
  283.      }
  284. //----
  285.    if(myOrderType == 1 && ContinueOpening)
  286.      {       
  287.               if((Bid - LastPrice) >= Pips*Point || OpenOrders < 1)
  288.                 {               
  289.                          SellPrice = Bid;                               
  290.                          LastPrice = 0;
  291.                          //----
  292.            if(TakeProfit == 0)
  293.                              tp = 0;
  294.                          else
  295.                              tp = SellPrice - TakeProfit*Point;
  296.                          //----
  297.            if(InitialStop == 0)
  298.                              sl=0;
  299.                          else
  300.                              sl=SellPrice+InitialStop*Point;  
  301.                          //----
  302.            if(OpenOrders != 0)
  303.                            {
  304.                                     mylotsi=lotsi;                       
  305.                                     //----
  306.                for(cnt = 1; cnt <= OpenOrders; cnt++)
  307.                                                if(MaxTrades > 12)
  308.                                                    mylotsi = NormalizeDouble(mylotsi*1.5, 1);
  309.                                                else
  310.                                                    mylotsi = NormalizeDouble(mylotsi*2, 1);
  311.                            }
  312.                          else
  313.                              mylotsi = lotsi;
  314.                          //----
  315.            if(mylotsi > 100)
  316.                              mylotsi = 100;
  317.                          OrderSend(Symbol(), OP_SELL, mylotsi, SellPrice, slippage, sl, tp, NULL, 0, 0, Red);                                        
  318.                          return(0);
  319.                 }
  320.      }
  321. //----
  322.    if(myOrderType == 2 && ContinueOpening)
  323.      {
  324.               if((LastPrice - Ask) >= Pips*Point || OpenOrders < 1)
  325.                 {               
  326.                          BuyPrice = Ask;
  327.                          LastPrice = 0;
  328.                          //----
  329.            if(TakeProfit == 0)
  330.                              tp = 0;
  331.                          else
  332.                              tp = BuyPrice + TakeProfit*Point;
  333.                          //----
  334.            if(InitialStop == 0)  
  335.                              sl = 0;
  336.                          else
  337.                              sl = BuyPrice - InitialStop*Point;
  338.                          //----
  339.            if(OpenOrders != 0)
  340.                            {
  341.                                     mylotsi = lotsi;                       
  342.                                     //----
  343.                for(cnt = 1; cnt <= OpenOrders; cnt++)
  344.                                       {
  345.                                                if(MaxTrades > 12)
  346.                                                    mylotsi = NormalizeDouble(mylotsi*1.5, 1);
  347.                                                else
  348.                                                    mylotsi = NormalizeDouble(mylotsi*2, 1);
  349.                                       }
  350.                            }
  351.                          else
  352.                              mylotsi = lotsi;
  353.            //----
  354.            if(mylotsi > 100)
  355.                mylotsi = 100;
  356.            OrderSend(Symbol(), OP_BUY, mylotsi, BuyPrice, slippage, sl, tp, NULL, 0, 0, Blue);                    
  357.            return(0);
  358.                 }
  359.      }   
  360. //----
  361.    return(0);
  362.   }
  363. //+------------------------------------------------------------------+
复制代码
柒侠伍义_李易俸
编写EA课程,代编写(付费)
https://shop34551999.world.taobao.com
http://liithong.com/
http://mt4ea.com
http://mt5ea.com

2

主题

31

回帖

938

积分

积分
938
发表于 2009-7-18 08:13:01 | 显示全部楼层
呵呵,复制研究

0

主题

25

回帖

109

积分

积分
109
发表于 2009-7-18 09:59:48 | 显示全部楼层
xiexiele ,yanjiuiyixia

5

主题

213

回帖

620

积分

积分
620
QQ
发表于 2009-7-18 15:28:28 | 显示全部楼层
哈哈 谢谢柒侠伍义版主的回复。:dabin8

0

主题

88

回帖

416

积分

积分
416
发表于 2009-7-29 14:04:56 | 显示全部楼层
呵呵,不要浪费时间做这种垃圾!
倍鞅策略,所谓“动态加倍网格”。等鞅加倍,与倒金字塔加码有相似之处,市场大忌。同品种对冲,就是网格的变形。异品种对冲,需要的技巧不是倍鞅策略所能优化的。仅从数学处理技巧上下功夫,不是以市场结构为基础的交易系统,风险是很大的。资金曲线的大起大落,表明这种策略的不稳定性和风险。作为一种思路和试探可以。稳定盈利。。。难!
波涛先生在他的书中提出“连续赢时减码,连续输时加码”的等价鞅策略。这种策略用在实战中是很危险的。
根据实战经验,以及对市场波动的本质特征(结构性;秩序性;随机性;不确定周期性;。。。。)的深刻认识和把握,决不应该推崇如此的风险控制理念。
由于价格波动中随机性部分的强度远远大于非随机性部分,
而且无论随机性部分或非随机性部分的统计特征都存在相当程度的不稳定性 。
无法保证“使用加倍技术”的后果一定是盈利。
反之,如果加码的结果导致了更大的亏损,你是停下来,还是应该继续加码?这无论从风险的角度还是心理的角度都已经是一场灾难。
这种灾难甚至可能从根本上摧毁你对这套系统的信心。
而实际上这套系统的失败仅仅是由于采用了不合适的风险控制和头寸调整策略而已。
与等价鞅策略不同的是反等价鞅策略,即盈利加码,亏损减码。
这种头寸调整策略在老范的书中有较多的介绍。它对于高资金杠杆的市场尤为适用。
采用这种头寸调整模型,可以做到在系统连续盈利时扩大头寸,在系统连续亏损时减少头寸。                
只要赢一手就能转败为胜,这个可能性确确实实是存在的,
这个可能性对于每一个人都有着致命的诱惑力.
只是,关键问题在于当这一刻终于到来之前,我们的脑袋心脏和钱袋是否能够承受得住这无边无际的重压?
“一件事不管多频繁地获得成功,但如果失败一次的代价太沉重,那么它就没有意义”。塔勒波管他叫“欹斜问题”。
个人看法,仅供参考

评分

参与人数 1贡献 +8 收起 理由
柒侠伍义 + 8

查看全部评分

2

主题

260

回帖

688

积分

积分
688
发表于 2009-7-31 00:18:17 | 显示全部楼层
本帖最后由 heping120 于 2009-7-31 00:19 编辑

我有逢亏加倍 EA 加我Q215393499  一起改进
55.JPG

0

主题

189

回帖

281

积分

积分
281
发表于 2009-8-26 12:27:35 | 显示全部楼层
9# 柒侠伍义
谢谢七侠,也谢谢LZ
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

风险提示:本站内容仅供学习交流,不构成投资建议;禁止开户导流、喊单与代客理财。系统已启用敏感词自动进审/禁发。 · 客服/举报
小黑屋|手机版|Archiver|联系我们|法律声明|智慧网

Powered by Discuz! X5.0 Licensed © 2001-2026 Discuz! Team.|京ICP备15025159号-2

QQ客服返回顶部