Ask questions on technical analysis, discuss trading systems and improve your MQL5 programming skills to develop your own trading strategies. Communicate and share your experience with traders from anywhere in the world, answer questions and help beginners — MQL5.community is developing along with you. Save Order Highest Profit and Lowest...
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property script_show_inputs
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
extern int TakeProfit =100;
extern int StopLoss = 100;
void OnStart()
{
double TakeProfitLevel;
double StopLossLevel;
TakeProfitLevel = Bid + TakeProfit*Point; //point=0.00001
StopLossLevel = Bid - StopLoss*Point;
/*
ticket # can return:
ticket #; OR
-1 (if OrderSend failed)
*/
int ticket;
ticket = OrderSend("EURUSD", OP_BUY, 1.0, Ask, 10, StopLossLevel, TakeProfitLevel, "My EA!");
if(ticket < 0)
{
Alert("Error!");
}
else
{
Alert("Your ticket # is:" + string(ticket));
}
}