leoleozhao 发表于 2022-1-16 18:16:43

单根K线开仓或报警一次的问题,大神有请!!!!!

单根K线开仓或报警一次的问题,大神有请!!!!!

int    bar=0;

void OnTick(void)
{
   if(Bars<100)
   {
      Print("bars less than 100");
      return;
      }
if(bar==Bars)
{
      return;
}

if(bar!=Bars)
   {
               
if(金叉)      
      {
            SendNotification(Symbol()+": 金叉 !!!");
            SendMail(Symbol(),": 金叉!!!");
            bar= Bars;
      }
      return;
if(死叉)
      {
            SendNotification(Symbol()+": 死叉 !!!");
            SendMail(Symbol(),": 死叉 !!!");
            bar= Bars;
      }
      return;
   }

   total=OrdersTotal();
//--- it is important to enter the market correctly, but it is more important to exit it correctly...   
   for(cnt=0;cnt<total;cnt++)
   {
平多仓
平空仓

   }
}

leoleozhao 发表于 2022-1-16 18:17:18

上面自己编的,但是不会报警。。。?请大神指教!!!

唐老师 发表于 2022-1-18 17:43:06

SendMail和SendNotification都需要设置客户端,可以看我之前写过的文章,在ea学院栏目里,关于邮件报警的。
至于其它的,你的代码不完整,而且我们不是专业教编程的,就不好说了。
页: [1]
查看完整版本: 单根K线开仓或报警一次的问题,大神有请!!!!!