Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //+------------------------------------------------------------------+
- //| OrderTest.mq4 |
- //| Copyright 2014, MetaQuotes Software Corp. |
- //| http://www.mql5.com |
- //+------------------------------------------------------------------+
- #property copyright "Copyright 2014, MetaQuotes Software Corp."
- #property link "http://www.mql5.com"
- #property version "1.00"
- #property strict
- //+------------------------------------------------------------------+
- //| Script program start function |
- //+------------------------------------------------------------------+
- extern double TakeProfit=40.0;
- extern double StopLoss=40.0;
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- void OnStart()
- {
- Alert("////////////////////////////");
- Alert("Bid: ", Bid);
- Alert("Ask: ", Ask);
- Alert("Point: ", Point); //0.00001
- /****************************************************/
- double TakeProfitLevel=Bid+TakeProfit*Point; //0.0001
- double StopLossLevel=Bid-StopLoss*Point;
- NormalizeDouble(TakeProfitLevel, Digits);
- NormalizeDouble(StopLossLevel, Digits);
- Alert("TakeProfitLevel: ",TakeProfitLevel);
- Alert("StopLossLevel: ",StopLossLevel);
- /****************************************************/
- double StopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL)/10;
- double Spread=MarketInfo(Symbol(),MODE_SPREAD)/10;
- double StopLevel_Spread=StopLevel+Spread;
- //double Test = MarketInfo(Symbol(),MODE_TICKVALUE);
- Alert("STOPLEVEL: ",StopLevel);
- Alert("SPREAD: ",Spread);
- Alert("STOPLEVEL+SPREAD: ",StopLevel_Spread);
- //Alert("Test: ",Test);
- /****************************************************/
- int ticket;
- ticket=OrderSend("EURUSD",OP_BUY,1.0,Bid,10,StopLossLevel,TakeProfitLevel,"My 1st Order!");
- if(ticket<0)
- {
- int err_code = GetLastError();
- Alert("Error code: ",err_code);
- }
- else
- {
- Alert("Your ticket # is: "+string(ticket));
- }
- }
- //+------------------------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement