Ice

46
// ตัวอย่างการเปิดคำสั่งซื้อทอง
void OpenBuyOrder() {
double lotSize = 0.1; // ขนาดล็อต
double stopLoss = Bid - 50 * Point; // ตั้ง Stop Loss
double takeProfit = Bid + 100 * Point; // ตั้ง Take Profit
int ticket = OrderSend(Symbol(), OP_BUY, lotSize, Ask, 2, stopLoss, takeProfit, "Buy Order", 0, 0, Blue);
if(ticket < 0) {
Print("Error in opening buy order: ", GetLastError());
} else {
Print("Buy order opened successfully with ticket #", ticket);
}
}

// ตัวอย่างการเปิดคำสั่งขายทอง
void OpenSellOrder() {
double lotSize = 0.1; // ขนาดล็อต
double stopLoss = Ask + 50 * Point; // ตั้ง Stop Loss
double takeProfit = Ask - 100 * Point; // ตั้ง Take Profit
int ticket = OrderSend(Symbol(), OP_SELL, lotSize, Bid, 2, stopLoss, takeProfit, "Sell Order", 0, 0, Red);
if(ticket < 0) {
Print("Error in opening sell order: ", GetLastError());
} else {
Print("Sell order opened successfully with ticket #", ticket);
}
}

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.