OrderCloseを使用します。
例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
//+------------------------------------------------------------------+ //| test_scr.mq4 | //| Copyright 2020, Hiroshi | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, Hiroshi" #property link "https://www.mql5.com" #property version "1.00" #property strict #property script_show_inputs //パラメーター入力ウインドウ input int ticket; //チケット番号 //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- bool ret_select; //選択状況 ret_select = OrderSelect( ticket,SELECT_BY_TICKET); //ポジションの選択 bool ret_close; ret_close = OrderClose( ticket, OrderLots(), OrderClosePrice(),3);//決済注文 MessageBox("選択状況 = " + ret_select + " 決済状況=" + ret_close); } //+------------------------------------------------------------------+ |
コメント