sirema 发表于 2020-11-18 13:01:23

感谢分享哦

zydshool 发表于 2021-6-12 07:43:43

{:1_178:}{:1_178:}找到了没有楼主

zydshool 发表于 2021-6-12 07:48:53

void OnTick()
{
   yidong();//当盈利100点的时候,启动保本1个点,当盈利200点的时候启动移动止损200点
   
}
void yidong()
{
    for(int i=0;i<OrdersTotal();i++)//移动止损通用代码,次代码会自动检测buy和sell单并对其移动止损
         {
            if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
            {
                if(OrderType()==0 && OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
                  {
                     if(ydd>0 && (Bid-OrderOpenPrice()) >=Point*ydd)
                      {
                         if(OrderStopLoss()<(Bid-Point*ydd) || (OrderStopLoss()==0))
                           {
                              OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*ydd,OrderTakeProfit(),0,Green);
                           }
                      }      
                     if((Bid-OrderOpenPrice()) >=Point*yll)
                      {
                         if(OrderStopLoss()<(Bid+Point*1) || (OrderStopLoss()==0))
                           {
                              OrderModify(OrderTicket(),OrderOpenPrice(),Bid+Point*1,OrderTakeProfit(),0,Green);
                           }
                      }   
                  }
                if(OrderType()==1 && OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
                  {
                  if(ydd>0 && (OrderOpenPrice()-Ask)>=(Point*ydd))
                      {
                         if((OrderStopLoss()>(Ask+Point*ydd)) || (OrderStopLoss()==0))
                           {
                              OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*ydd,OrderTakeProfit(),0,Red);
                           }
                      }
                  if((OrderOpenPrice()-Ask)>=(Point*yll))
                      {
                         if((OrderStopLoss()>(Ask-Point*1)) || (OrderStopLoss()==0))
                           {
                              OrderModify(OrderTicket(),OrderOpenPrice(),Ask-Point*1,OrderTakeProfit(),0,Red);
                           }
                      }
                  }
               }
         }
}

pbp 发表于 2021-7-4 21:33:22

支持下

诬告 发表于 2021-7-13 10:26:31

顶下

天下汇 发表于 2021-7-13 20:04:01

{:1_179:}

羊总 发表于 2021-8-2 21:05:27

支持下

补考 发表于 2024-6-10 17:11:27

{:1_189:}

阿尔特意 发表于 2025-9-26 11:15:15

顶下
页: 1 2 [3]
查看完整版本: 仓位出现盈利但又未达到目标,EA如何设置保本策略?