客服热线:18391752892

向柒侠请教CLOSEBUY。

   日期:2019-01-12     浏览:1000    
马上注册,结交更多好友,下载更多资源

您需要 登录 才可以下载或查看,没有帐号?注册 这些日子拜读了您老的贴子后,不懂一点编程的我若有所悟,自己用您的模版试着表达了一下我的意思,意思很简单,只用三条均线,
 MA1=5,MA2=10,MA3=30
 当MA1上穿MA2,且MA2在MA3之上时做多。
 当MA2下穿MA2,且MA2在MA3之下时做空。
 
 当MA1上穿MA2时先平掉多仓,
 当MA2下穿MA2先平掉空仓。
 
 可是发现怎么也调用不了CloseBuy和CloseSell,
 整个代码如下,望老师指点。。
 
 
 //+------------------------------------------------------------------+
 //|                                       kkkk.mq4 |
 //|                                       mengtong |
 //|                         http://www.hahahahahahaha.net |
 //+------------------------------------------------------------------+
 #property copyright mengtong
 #property link      http://www.hahahahahahaha.net
 
 extern double ma1=5,ma2=10,ma3=30;
 double ma1now,ma1now2,ma2now,ma2now2,ma3now,ma3now2,ma1bnow,ma2bnow,ma3bnow;
 ////////////////////////
 extern string _资金管理_ = 任选一个
 extern bool zijiguanli1= true;//false true、、
 extern bool zijiguanli2= false;//false true、、
 extern bool zijiguanli3= false;//false true、、
 ///////////////////////////////////
 extern double cheng=1;
 int cnt;
 int i;
 string text=
 double TrailingStop=0;
 double aa=0;
 int s=0,b=0;
 double CurrentBasket=0;
 double LotMM=0;
 double lotstart=0;
 double LotsMax=100;
 extern double lotab=0.1;
 double lots=0;
 double TP=0,TPP=0,SL=0,SLL=0;
 int slip=6;
 ///////////////////////////////////////
 double mode=0;
 double LastOrderType;
 double LastPricesell;
 double LastPricebuy;
 double LastPrice;
 double OpenSells;
 double OpenSellStops;
 double OpenBuys;
 double OpenBuyStops;
 //+------------------------------------------------------------------+
 //| expert initialization function |
 //+------------------------------------------------------------------+
 int init()
 {
 //----
 
 //----
 return(0);
 }
 //+------------------------------------------------------------------+
 //| expert deinitialization function |
 //+------------------------------------------------------------------+
 int deinit()
 {
 //----
 
 //----
 return(0);
 }
 
 //+------------------------------------------------------------------+
 //| expert start function |
 //+------------------------------------------------------------------+
 int start()
 {
 //----
 jiancha();//检查判断
 MoneyManagement();//资金管理
 ma();//指标管理
 zhangchang();//战场管理
 TrailingStop();
 CloseBuy();
 CloseSell();
 xianshi();
 //----
 return(0);
 }
 //+------------------------------------------------------------------+
 void jiancha()
 {
 
 b=0;s=0;
 for (int cnt=0; cntma3now
  ma1now20) { SLL=Ask-SL*Point; }
 OrderSend(Symbol(),OP_BUY,LotMM,Ask,slip,SLL,TPP, M +Period()+ ,0,0,Violet);
 
 return(0); }
 //+------------------------------------------------------------------+
 void sellme(){
 if (TP==0) { TPP=0; } if(TP 0) { TPP=Bid-(TP*Point); }
 if (SL==0) { SLL=0; } if(SL 0) { SLL=Bid+(SL*Point); }
 OrderSend(Symbol(),OP_SELL,LotMM,Bid,2,SLL,TPP, M +Period()+ ,0,0,GreenYellow);
 return(0); }
 //+------------------------------------------------------------------+
 
 //+------------------------------------------------------------------+
 
 void TrailingStop()
 {
 for(cnt=OrdersTotal();cnt cnt--)
 {
 OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
 if (OrderSymbol() == Symbol() )// OrderMagicNumber()==MAGICMA)
 {
 if (OrderType()==OP_SELL)
 {
 if(TrailingStop 0)
 {
 if((OrderOpenPrice()-Ask) (Point*TrailingStop))
 {
 if((OrderStopLoss() (Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
 {
 OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
 return(0);
 }
 }
 }
 }
 
 if (OrderType()==OP_BUY)
 {
 if(TrailingStop 0)
 {
 if(Bid-OrderOpenPrice() Point*TrailingStop)
 {
 if(OrderStopLoss() 0 )
 {
 for(i=OrdersTotal()-1;i 0 )
 {
 for(i=OrdersTotal()-1;i
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!


特别提示:本信息由相关企业自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


0相关评论
相关行情快递
推荐行情快递
点击排行