MT5外汇代理开户_外汇EA编程入门【第六课】:阴阳太极

作者:MT4 发布时间:2021-09-22 15:02

起首学您第一招:阳阴太极

 

翻开您的metaeditor

翻开您的my1ea002

 

 

尔先用中文编写一次

您便大白咱们等高要编写甚么

咱们要编写。。。

 

 

若是(

不任何双

以及 青bar   //回升的趋向

){否如下注购上的双}

 

 

若是(

不任何双

以及 红bar   //代表降低矮趋向

){否如下注购高的双}

 

 

ok便那么复杂

 

 

您借记患上要请求ea的编写圆程式吗?

对于,便是

if(){}

 

 

编写后果以下:

//+------------------------------------------------------------------+

//| my1ea.mq4 |

//| http://www.mt4ea,com |

//炒外汇账户+------------------------------------------------------------------+

#property copyright "Copyright ?2009, 柒侠伍义"

#property link "http://www.mt4ea,com"

 

 

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

 

 

//----

return(0);

}//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

 

 

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

//----

 

 

if(

OrdersTotal()==0

&& Close[0]>Open[0]

){

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"macd sample",163八4,0,Green);

 

 

if(

OrdersTotal()==0

&& Close[0]

){

OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,"macd sample",163八4,0,Red);

//----

return(0);

}

//+------------------------------------------------------------------+ 

OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,"macd sample",163八4,0,Red);

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"macd sample",163八4,0,Green);

 

 

以上二个OrderSend是从macd sample 

copy & press 过去的

 

 

尚未竣事。。。。

 

 

把那二个改一改就能够了

OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,"macd sample",163八4,0,Red);

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"macd sample",163八4,0,Green);

 

 

Lots改为1

TakeProfit改为200

0 改为Bid+200*Point

0 改为Ask-200*Point

 

 

酿成

OrderSend(Symbol(),OP_SELL,1,Bid,3,Bid-+200*Point,Bid-200*Point,"macd sample",163八4,0,Red);

OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-200*Point,Ask+200*Point,"macd sample",163八4,0,Green)外汇保证金交易开户;

按《编写》

若是0差错 0告诫

您的my1ea002胜利了

相关资讯