Advertisement
Guest User

res2

a guest
Aug 26th, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.52 KB | None | 0 0
  1. //+------------------------------------------------------------------+
  2. //|                                                    OrderTest.mq4 |
  3. //|                        Copyright 2014, MetaQuotes Software Corp. |
  4. //|                                              http://www.mql5.com |
  5. //+------------------------------------------------------------------+
  6. #property copyright "Copyright 2014, MetaQuotes Software Corp."
  7. #property link      "http://www.mql5.com"
  8. #property version   "1.00"
  9. #property strict
  10. //+------------------------------------------------------------------+
  11. //| Script program start function                                    |
  12. //+------------------------------------------------------------------+
  13. extern double TakeProfit=40.0;
  14. extern double StopLoss=40.0;
  15. //+------------------------------------------------------------------+
  16. //|                                                                  |
  17. //+------------------------------------------------------------------+
  18. void OnStart()
  19.   {  
  20.    Alert("////////////////////////////");
  21.    Alert("Bid: ", Bid);
  22.    Alert("Ask: ", Ask);
  23.    Alert("Point: ", Point); //0.00001
  24.    /****************************************************/
  25.    double TakeProfitLevel=Bid+TakeProfit*Point;   //0.0001
  26.    double StopLossLevel=Bid-StopLoss*Point;
  27.    double ASK = NormalizeDouble(Ask, Digits);
  28.    double BID = NormalizeDouble(Bid, Digits);
  29.    
  30.    Alert("BID: ", BID);
  31.    Alert("ASK: ", ASK);
  32.    
  33.    TakeProfitLevel = NormalizeDouble(TakeProfitLevel, Digits);
  34.    StopLossLevel = NormalizeDouble(StopLossLevel, Digits);
  35.    
  36.    Alert("TakeProfitLevel: ",TakeProfitLevel);
  37.    Alert("StopLossLevel: ",StopLossLevel);
  38.    /****************************************************/
  39.    
  40.    double StopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL)/10;  
  41.    double Spread=MarketInfo(Symbol(),MODE_SPREAD)/10;
  42.    double StopLevel_Spread=StopLevel+Spread;
  43.    //double Test = MarketInfo(Symbol(),MODE_TICKVALUE);
  44.    
  45.    Alert("STOPLEVEL: ",StopLevel);
  46.    Alert("SPREAD: ",Spread);
  47.    Alert("STOPLEVEL+SPREAD: ",StopLevel_Spread);
  48.    //Alert("Test: ",Test);
  49.  
  50.    /****************************************************/
  51.  
  52.    int ticket;
  53.    ticket=OrderSend("EURUSD",OP_BUY,1.0,ASK,10,StopLossLevel,TakeProfitLevel,"My 1st Order!");
  54.  
  55.    if(ticket<0)
  56.      {
  57.      int err_code = GetLastError();
  58.       Alert("Error code: ",err_code);
  59.      }
  60.    else
  61.      {
  62.       Alert("Your ticket # is: "+string(ticket));
  63.      }
  64.    
  65.   }
  66. //+------------------------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement