📅 财经日历 📊 实时波动 📈 大盘云图 📶 行情走势 🆚 投机情绪 🚀 今日热点

    求助

    twy888 LV3
    2025-07-17 · 697 阅读
    这个EA设置的盈利点数平仓回测的时候没问题到了点数全部平仓,但是挂在模拟盘几张订单盈利到了平仓点数它就不全部平仓,只平仓最后下单那张订单,这是什么情况
    ""
    还没有人打赏,支持一下
    回复

    举报

     

    回答|共 4 个

    Sure63219 LV3

    发表于 2025-7-17 19:32:52 | 显示全部楼层

    可以加我V交流一下,Lee343471826

    金子涵 LV4

    发表于 2025-7-17 21:07:16 | 显示全部楼层

    1. //+-----------------------------------------------------平均盈利平仓-----------------------------------------------------+
    2. if(单边均价盈N微点全平_0为关闭!=0)
    3. {
    4.     bool closeAllBuys = false;
    5.     bool closeAllSells = false;
    6.    
    7.     // 先检查是否满足平仓条件
    8.     if(平仓前多单总盈利 > 单边均价盈N微点全平_0为关闭*平仓前多单总手数*美元点值)
    9.         closeAllBuys = true;
    10.         
    11.     if(平仓前空单总盈利 > 单边均价盈N微点全平_0为关闭*平仓前空单总手数*美元点值)
    12.         closeAllSells = true;
    13.    
    14.     // 如果满足条件,则平掉所有对应方向的订单
    15.     if(closeAllBuys || closeAllSells)
    16.     {
    17.         for(int i5=OrdersTotal()-1; i5>=0; i5--)
    18.         {
    19.             if(OrderSelect(i5,SELECT_BY_POS,MODE_TRADES)==true)
    20.                 if(OrderSymbol()==Symbol() && OrderMagicNumber()== EA交易ID)
    21.                 {
    22.                     if(closeAllBuys && OrderType()==OP_BUY)
    23.                     {
    24.                         bool 多单平仓=OrderClose(OrderTicket(),OrderLots(),Bid,500,White);
    25.                         if(多单平仓)
    26.                             printf("均价盈利 全平多!");
    27.                     }
    28.                     if(closeAllSells && OrderType()==OP_SELL)
    29.                     {
    30.                         bool 空单平仓=OrderClose(OrderTicket(),OrderLots(),Ask,500,White);
    31.                         if(空单平仓)
    32.                             printf("均价盈利 全平空!");
    33.                     }
    34.                 }
    35.         }
    36.     }
    37. }
    复制代码


    金子涵 LV4

    发表于 2025-7-17 21:07:52 | 显示全部楼层

    1. //+-----------------------------------------------------突破上轨平多破下轨平空-----------------------------------------------------+
    2. if(突破上轨平多破下轨平空)
    3. {
    4.     bool closeBuys = (收盘价 > 布林线上轨);
    5.     bool closeSells = (收盘价 < 布林线下轨);
    6.    
    7.     if(closeBuys || closeSells)
    8.     {
    9.         for(int i5=OrdersTotal()-1; i5>=0; i5--)
    10.         {
    11.             if(OrderSelect(i5,SELECT_BY_POS,MODE_TRADES)==true)
    12.                 if(OrderSymbol()==Symbol() && OrderMagicNumber()== EA交易ID)
    13.                 {
    14.                     if(closeBuys && OrderType()==OP_BUY)
    15.                     {
    16.                         bool 多单平仓=OrderClose(OrderTicket(),OrderLots(),Bid,500,White);
    17.                         if(多单平仓)
    18.                             printf("突破上轨 全平多!");
    19.                     }
    20.                     if(closeSells && OrderType()==OP_SELL)
    21.                     {
    22.                         bool 空单平仓=OrderClose(OrderTicket(),OrderLots(),Ask,500,White);
    23.                         if(空单平仓)
    24.                             printf("突破下轨 全平空!");
    25.                     }
    26.                 }
    27.         }
    28.     }
    29. }
    复制代码


    twy888 LV3

    发表于 2025-7-17 21:52:59 | 显示全部楼层


    是要替换里面的代码吗
    您需要登录后才可以回帖 登录 | 注册

    提醒: 禁止引战、谩骂、灌水内容

    微信二维码

    有问题联系客服