当前位置: 首页 > news >正文

如何访问服务器上的网站国内精美网站界面网址

如何访问服务器上的网站,国内精美网站界面网址,全国企业信用信息平台,石材网站建设多少钱MT5编程#xff0c;有两种方式#xff0c;一种是函数式编程#xff0c;一种是面向对象编程。 面向对象编程#xff0c;会让我们编写代码变得非常简单。 面向对象编程#xff0c;主要是要熟悉4个类库。 #include Trade\PositionInfo.mqh #include Trade\Tra…MT5编程有两种方式一种是函数式编程一种是面向对象编程。 面向对象编程会让我们编写代码变得非常简单。 面向对象编程主要是要熟悉4个类库。 #include Trade\PositionInfo.mqh #include Trade\Trade.mqh #include Trade\SymbolInfo.mqh #include Trade\OrderInfo.mqh 其中  PositionInfo 是持仓单信息  OrderInfo    是挂单信息 SymbolInfo  是品种信息 Trade    是交易类库 使用之前需要定义各种对象的实例 CPositionInfo m_position; // trade position object CTrade m_trade; // trading object CSymbolInfo m_symbol; // symbol info object COrderInfo m_order; // pending orders object 交易之前在初始化函数里面要指定一些相应的属性 //---m_trade.SetExpertMagicNumber(m_magic); //指定魔术号 //---if(IsFillingTypeAllowed(SYMBOL_FILLING_FOK))m_trade.SetTypeFilling(ORDER_FILLING_FOK);elseif(IsFillingTypeAllowed(SYMBOL_FILLING_IOC))m_trade.SetTypeFilling(ORDER_FILLING_IOC);elsem_trade.SetTypeFilling(ORDER_FILLING_RETURN); //---m_trade.SetAsyncMode(true); //指定异步模式有了这条可瞬时下单上万单m_trade.SetDeviationInPoints(m_slippage); 下面就不一一介绍了我给出一个挂单EA的全部源码可直接下载下去好好学习。 //------------------------------------------------------------------ //| EA Stop Order(barabashkakvns edition).mq5 | //------------------------------------------------------------------ #property copyright Copyright © 2011, Хлыстов Владимир #property link cmillionnarod.ru #property version 2.00 #property description Advisor opens a grid of stop orders #property description When the specified profit level is reached, #property description it closes all positions and deletes all pending orders //--- #include Trade\PositionInfo.mqh #include Trade\Trade.mqh #include Trade\SymbolInfo.mqh #include Trade\OrderInfo.mqh CPositionInfo m_position; // trade position object CTrade m_trade; // trading object CSymbolInfo m_symbol; // symbol info object COrderInfo m_order; // pending orders object //--- input parameters input double InpProfitClose 5; // Profit purpose (in money) input bool InpBuyStop true; // Use Buy stop input bool InpSellStop true; // Use Sell stop input int InpMaxOrders 10; // Maximum pending orders input ushort InpStopLoss 0; // StopLoss (0 - off) input ushort InpTakeProfit 0; // TakeProfit (0 - off) input ushort InpDistance 100; // Distance from current price input double InpLots 0.1; // Lots input double InpLotRatio 1.5; // Lot Ratio input ulong m_magic72994760; // magic number //--- ulong m_slippage10; // slippagedouble ExtStopLoss0.0; double ExtTakeProfit0.0; //--- //--- bool m_bln_close_allfalse; // true - you must close all positions //------------------------------------------------------------------ //| Expert initialization function | //------------------------------------------------------------------ int OnInit(){if(InpLotRatio0.0){string text__FUNCTION__, ERROR: The parameter \Lot Ratio\ can not be less than or equal to zero;Print(text);Alert(text);return(INIT_PARAMETERS_INCORRECT);} //---if(!m_symbol.Name(Symbol())) // sets symbol namereturn(INIT_FAILED);RefreshRates();string err_text;if(!CheckVolumeValue(InpLots,err_text)){Print(__FUNCTION__,, ERROR: ,err_text);return(INIT_PARAMETERS_INCORRECT);} //---m_trade.SetExpertMagicNumber(m_magic); //---if(IsFillingTypeAllowed(SYMBOL_FILLING_FOK))m_trade.SetTypeFilling(ORDER_FILLING_FOK);elseif(IsFillingTypeAllowed(SYMBOL_FILLING_IOC))m_trade.SetTypeFilling(ORDER_FILLING_IOC);elsem_trade.SetTypeFilling(ORDER_FILLING_RETURN); //---m_trade.SetAsyncMode(true);m_trade.SetDeviationInPoints(m_slippage); //---ExtStopLossInpStopLoss*m_symbol.Point();ExtTakeProfitInpTakeProfit*m_symbol.Point(); //---m_bln_close_allfalse; // true - you must close all positions //---return(INIT_SUCCEEDED);} //------------------------------------------------------------------ //| Expert deinitialization function | //------------------------------------------------------------------ void OnDeinit(const int reason){ //---}double Ask,Bid; //------------------------------------------------------------------ //| | //------------------------------------------------------------------ int RefreshRates0(string symbol){if(symbol)symbol_Symbol;MqlTick last_tick;SymbolInfoTick(symbol,last_tick);double Bid0last_tick.bid;SymbolInfoTick(_Symbol,last_tick);Bidlast_tick.bid;Asklast_tick.ask;if(Bid00)Print(刷新数据失败,请检查MT5是不是掉线了,或者打开对应图表加速数据图表更新 symbol);if((Bid0)0)return(0);elsereturn(1);}input bool 启用新增功能1; //------------------------------------------------------------------ //| | //------------------------------------------------------------------ void funx(){if(启用新增功能false)return;if(A_Mq4_FirstOpen_Price(0)0)if(BidA_Mq4_FirstOpen_Price(0))if(Countlots(1)Countlots(0))m_trade.Buy(Countlots(1)-Countlots(0), m_symbol.Name(), Ask, 0.0, 0.0, _sc);if(BidA_Mq4_FirstOpen_Price(1))if(Countlots(1)Countlots(0))m_trade.Sell(Countlots(0)-Countlots(1), m_symbol.Name(), Bid, 0.0, 0.0, _sc);} //------------------------------------------------------------------ //| Expert tick function | //------------------------------------------------------------------ void OnTick(){RefreshRates0();funx();if(m_bln_close_all){CloseAllPositions();DeleteAllOrders();if(CalculateAllPositions()0.0 CalculateAllPendingOrders()0.0)m_bln_close_allfalse;} //---double Profit0.0;for(int iPositionsTotal()-1;i0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()m_symbol.Name() m_position.Magic()m_magic)Profitm_position.Commission()m_position.Swap()m_position.Profit(); //---if(ProfitInpProfitClose) // close all{m_bln_close_alltrue;return;} //---if(CalculateAllPendingOrders()!0){MoveOrder();return;} //---if(!RefreshRates())return;int StopsLevelm_symbol.StopsLevel();if(StopsLevel0)StopsLevelm_symbol.Spread()*3;for(int i1; iInpMaxOrders; i){if(InpDistance*iStopsLevel){double Lot(i1)?InpLots:LotCheck(InpLots*(double)(i-1)*InpLotRatio);if(Lot!0.0){if(InpBuyStop){double Pricem_symbol.NormalizePrice(m_symbol.Ask()(double)InpDistance*(double)i*m_symbol.Point());double sl(InpStopLoss0)?0.0:m_symbol.NormalizePrice(Price-ExtStopLoss);double tp(InpTakeProfit0)?0.0:m_symbol.NormalizePrice(PriceExtTakeProfit);m_trade.BuyStop(Lot,Price,m_symbol.Name(),sl,tp);}if(InpSellStop){double Pricem_symbol.NormalizePrice(m_symbol.Bid()-(double)InpDistance*(double)i*m_symbol.Point());double sl(InpStopLoss0)?0.0:m_symbol.NormalizePrice(PriceExtStopLoss);double tp(InpTakeProfit0)?0.0:m_symbol.NormalizePrice(Price-ExtTakeProfit);m_trade.SellStop(Lot,Price,m_symbol.Name(),sl,tp);}}}} //---} //------------------------------------------------------------------ //| TradeTransaction function | //------------------------------------------------------------------ void OnTradeTransaction(const MqlTradeTransaction trans,const MqlTradeRequest request,const MqlTradeResult result){ //---} //------------------------------------------------------------------ //| Refreshes the symbol quotes data | //------------------------------------------------------------------ bool RefreshRates(void){ //--- refresh ratesif(!m_symbol.RefreshRates()){Print(RefreshRates error);return(false);} //--- protection against the return value of zeroif(m_symbol.Ask()0 || m_symbol.Bid()0)return(false); //---return(true);} //------------------------------------------------------------------ //| Check the correctness of the order volume | //------------------------------------------------------------------ bool CheckVolumeValue(double volume,string error_description){ //--- minimal allowed volume for trade operationsdouble min_volumem_symbol.LotsMin();if(volumemin_volume){error_descriptionStringFormat(Volume is less than the minimal allowed SYMBOL_VOLUME_MIN%.2f,min_volume);return(false);} //--- maximal allowed volume of trade operationsdouble max_volumem_symbol.LotsMax();if(volumemax_volume){error_descriptionStringFormat(Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX%.2f,max_volume);return(false);} //--- get minimal step of volume changingdouble volume_stepm_symbol.LotsStep();int ratio(int)MathRound(volume/volume_step);if(MathAbs(ratio*volume_step-volume)0.1){error_descriptionStringFormat(Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP%.2f, the closest correct volume is %.2f,volume_step,ratio*volume_step);return(false);}error_descriptionCorrect volume value;return(true);} //------------------------------------------------------------------ //| Checks if the specified filling mode is allowed | //------------------------------------------------------------------ bool IsFillingTypeAllowed(int fill_type){ //--- Obtain the value of the property that describes allowed filling modesint fillingm_symbol.TradeFillFlags(); //--- Return true, if mode fill_type is allowedreturn((filling fill_type)fill_type);} //------------------------------------------------------------------ //| Lot Check | //------------------------------------------------------------------ double LotCheck(double lots){ //--- calculate maximum volumedouble volumeNormalizeDouble(lots,2);double stepvolm_symbol.LotsStep();if(stepvol0.0)volumestepvol*MathFloor(volume/stepvol); //---double minvolm_symbol.LotsMin();if(volumeminvol)volumeminvol; //---double maxvolm_symbol.LotsMax();if(volumemaxvol)volumemaxvol;return(volume);} //------------------------------------------------------------------ //| Close all positions | //------------------------------------------------------------------ void CloseAllPositions(){for(int iPositionsTotal()-1;i0;i--) // returns the number of current positionsif(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()m_symbol.Name() m_position.Magic()m_magic)m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol} //------------------------------------------------------------------ //| Calculate all positions | //------------------------------------------------------------------ int CalculateAllPositions(){int total0;for(int iPositionsTotal()-1;i0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()m_symbol.Name() m_position.Magic()m_magic)total; //---return(total);}//------------------------------------------------------------------ int CountT(ENUM_POSITION_TYPE i0){int total0;for(int iPositionsTotal()-1;i0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()m_symbol.Name() m_position.Magic()m_magic)if(m_position.PositionType()i0)total; //---return(total);}//------------------------------------------------------------------ //| | //------------------------------------------------------------------ double Countlots(ENUM_POSITION_TYPE i0){double total0;for(int iPositionsTotal()-1;i0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()m_symbol.Name() m_position.Magic()m_magic)if(m_position.PositionType()i0)totaltotalm_position.Volume(); //---return(total);}//------------------------------------------------------------------ //| | //------------------------------------------------------------------ double A_Mq4_FirstOpen_Price(ENUM_POSITION_TYPE Type){double A_Mq4_FirstOpen_Price0;for(int i0; iPositionsTotal(); i)// for(int iPositionsTotal()-1;i0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()m_symbol.Name() m_position.Magic()m_magic)if(m_position.PositionType()Type){A_Mq4_FirstOpen_Pricem_position.PriceOpen();break;}return(A_Mq4_FirstOpen_Price);} //------------------------------------------------------------------ //| Calculate all pending orders for symbol | //------------------------------------------------------------------ int CalculateAllPendingOrders(){int total0;for(int iOrdersTotal()-1;i0;i--) // returns the number of current ordersif(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its propertiesif(m_order.Symbol()m_symbol.Name() m_order.Magic()m_magic)total; //---return(total);} //------------------------------------------------------------------ //| Delete all pending orders | //------------------------------------------------------------------ void DeleteAllOrders(){for(int iOrdersTotal()-1;i0;i--) // returns the number of current ordersif(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its propertiesif(m_order.Symbol()m_symbol.Name() m_order.Magic()m_magic)m_trade.OrderDelete(m_order.Ticket());} //------------------------------------------------------------------ //------------------------------------------------------------------ void MoveOrder(){int StopsLevelm_symbol.StopsLevel();if(StopsLevel0)StopsLevelm_symbol.Spread()*3;int b0;int s0;for(int i0;iOrdersTotal();i) // returns the number of current ordersif(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its propertiesif(m_order.Symbol()m_symbol.Name() m_order.Magic()m_magic){if(m_order.OrderType()ORDER_TYPE_BUY_STOP){RefreshRates();b;double zone(StopsLevel(b-1)*InpDistance)*m_symbol.Point();double newPriceOpenm_symbol.NormalizePrice(m_symbol.Ask()zone);if(m_order.PriceOpen()newPriceOpen){Print(BUY:,m_order.Ticket(),,,m_order.PriceOpen(),-,newPriceOpen,-,m_symbol.Ask());if(NormalizeDouble(newPriceOpen-m_order.PriceOpen(),8)!0){m_trade.OrderModify(m_order.Ticket(),newPriceOpen,m_order.StopLoss(),m_order.TakeProfit(),ORDER_TIME_GTC,0);}}}if(m_order.OrderType()ORDER_TYPE_SELL_STOP){RefreshRates();s;double zone(StopsLevel(s-1)*InpDistance)*m_symbol.Point();double newPriceOpenm_symbol.NormalizePrice(m_symbol.Bid()-zone);if(m_order.PriceOpen()newPriceOpen){Print(SELL:,m_order.Ticket(),,,m_order.PriceOpen(),-,newPriceOpen,-,m_symbol.Bid());if(NormalizeDouble(newPriceOpen-m_order.PriceOpen(),8)!0){m_trade.OrderModify(m_order.Ticket(),newPriceOpen,m_order.StopLoss(),m_order.TakeProfit(),ORDER_TIME_GTC,0);}}}}} //------------------------------------------------------------------
http://www.dnsts.com.cn/news/208665.html

相关文章:

  • 枣阳网站建设等服务延庆网站建设
  • 自己制作上传图片的网站怎么做广东新闻联播在线直播
  • 企业免费建站软件找人做网站要密码吗
  • 深圳宝安区深圳网站建设 骏域网络营销型网站测评方法
  • 农家乐网站 建设江苏盐城网站开发
  • 汽车配件网站模板html5效果网站
  • 怎么看自己做没做网站地图公众号开发信息在哪里
  • 做钓鱼网站获利3万wordpress 图片 主题
  • 网站登录超时怎么解决网站建设那个网站好
  • 网站建设及推广方案ppt建设一个网站的流程
  • 湛江网站搜索引擎推广在哪里可以接网站开发的外包
  • html网站制作答辩问题顺德电子画册网站建设
  • 档案信息网站建设遵循什么原则品牌vi
  • 公司网站域名如何备案优购物官方网站购物
  • 免费建设淘客网站成都微信小程序商城
  • 百度搜索网站下方描述快猫
  • 福建省建设厅网站 企业阿里云可以几个网站
  • 高校思政专题网站建设无货源网店哪个平台好
  • 免费行情软件网站下载大全爱wordpress内容页怎么分页
  • 网站编辑 图片批量网站开发颜色代码
  • wordpress搭建企业网站关键词搜索量全网查询
  • 网站管理公司 优帮云学会网站 建设
  • 建设银行网站网址wordpress关注公众号登录
  • 济宁网站建设的公司物流专线做网站
  • 连云港企业建站 网站网站建设怎样提升形象与品牌价值
  • wordpress 4.0 多站点windows 建网站
  • 手机网站欣赏做移动类网站的书推荐
  • 自己网站怎么做外链只使用html做简单网站
  • 网站上线前准备方案wordpress添加cnzz
  • 网站建设最流行语言免费logo设计在线设计