//+------------------------------------------------------------------+
//| tutorial20.mq4 |
//| Copyright 2020, MetaQuotes Software Corp. |
//| https://triantoadi.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link "https://triantoadi.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;
StopLossLevel = Bid - StopLoss*Point;
Alert("TakeProfitLevel = ", TakeProfitLevel);
Alert("StopLossLevel = ", StopLossLevel);
int ticket;
ticket = OrderSend("EURUSD", OP_BUY, 0.1, Ask, 10, StopLossLevel, TakeProfitLevel, "My 1st Order");
if(ticket<0)
{
Alert("Your Order Send Was Error !");
}
else
{
Alert("Your ordersend is successfully !");
}
Sleep(2000);
//OrderSelect
int res;
res = OrderSelect(ticket, SELECT_BY_TICKET);
if(res == false)
{
Alert("Your Order Select Was Error !");
}
else
{
Alert("Your OrderSelect is Successfully");
//masuk ke perinciannya :
Alert("Your information order #ticket", ticket, "= ");
Alert("OrderSymbol = ", OrderSymbol());
Alert("OrderType = ", OrderType());
Alert("Open Price = ", OrderOpenPrice());
Alert("Open Time = ", OrderOpenTime());
Alert("Lots = ", OrderLots());
Alert("StopLoss = ", OrderStopLoss());
Alert("TakeProfit = ", OrderTakeProfit());
Alert("Comment = ", OrderComment());
Alert("ClosePrice = ", OrderClosePrice());
Alert("CloseTime = ", OrderCloseTime());
Alert("Profit = ", OrderProfit());
}
}