//+------------------------------------------------------------------+ //| Export.mq4 | //| Copyright 2016, AM2 | //| http://www.forexsystems.biz | //+------------------------------------------------------------------+ #property copyright "Copyright 2016, AM2" #property link "http://www.forexsystems.biz" #property version "1.00" #property strict int type=0; double lot=0,sl=0,tp=0; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { Comment(""); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void Log(string s="") { //--- Открываем файл int h=FileOpen("log.txt",FILE_READ|FILE_WRITE|FILE_TXT); FileWrite(h,s); FileClose(h); // закрываем файл } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { for(int i=OrdersTotal()-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if(OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) { type=0; lot=OrderLots(); sl=OrderStopLoss(); tp=OrderTakeProfit(); } if(OrderType()==OP_SELL) { type=0; lot=OrderLots(); sl=OrderStopLoss(); tp=OrderTakeProfit(); } }//OrderSymbol sl=NormalizeDouble(sl,Digits); tp=NormalizeDouble(tp,Digits); Log(Symbol()+" "+(string)type+" "+(string)lot+" "+(string)sl+" "+(string)tp); RefreshRates(); }//OrderSelect }// Comment("\n Order Type: ",type, "\n Order Lots: ",lot, "\n StopLoss: ",sl, "\n TakeProfit: ",tp); } //+------------------------------------------------------------------+