読み取り専用

フォーラムは現在、読み取り専用のアーカイブとなっています。.

バグ報告やプラットフォームに関する質問はこちら → [email protected]

私たちのコミュニティはDiscordとYouTubeで活動しています。ぜひ参加してください!

ご参加ください Discord YouTube

Close All Positions Only for Selected Chart

3件の返信

Tomas Matejka

管理者、sq-ultimate、2件の返信.

プロフィールを表示

10年前 #114928

To close all open position and orders only for EURUSD for example (not for all active charts in MT) you would need a custom function that contains Symbol check

void sqCloseAllOrdersForChart() {
   for(int i=OrdersTotal()-1; i>=0; i--) {
      if (OrderSelect(i,SELECT_BY_POS)==true) {
         if((OrderType() == OP_BUY || OrderType() == OP_SELL) && Symbol() == OrderSymbol()) {
            sqClosePositionAtMarket(-1);
         } else if (Symbol() == OrderSymbol()) {
            tmpRet = OrderDelete(OrderTicket());
         }
      }
   }
}

これを EA Wizard / code / CustomFunctions.mq4 ファイルに追加してください。その後、添付の例に示されているように、Wizardでそのまま使用できます。.

0

ジョジョ

顧客、bbp_participant、コミュニティ、50件の返信。.

プロフィールを表示

10年前 #136035

To close all open position and orders only for EURUSD for example (not for all active charts in MT) you would need a custom function that contains Symbol check

void sqCloseAllOrdersForChart() {
   for(int i=OrdersTotal()-1; i>=0; i--) {
      if (OrderSelect(i,SELECT_BY_POS)==true) {
         if((OrderType() == OP_BUY || OrderType() == OP_SELL) && Symbol() == OrderSymbol()) {
            sqClosePositionAtMarket(-1);
         } else if (Symbol() == OrderSymbol()) {
            tmpRet = OrderDelete(OrderTicket());
         }
      }
   }
}

これを EA Wizard / code / CustomFunctions.mq4 ファイルに追加してください。その後、添付の例に示されているように、Wizardでそのまま使用できます。.

Thank you Tomas, this answers many of my prayers!

0

ジョジョ

顧客、bbp_participant、コミュニティ、50件の返信。.

プロフィールを表示

10年前 #136037

Quick question: Do we create another folder into which to place this file (…/code/CustomFunctions)? or place it in the Code folder?

0

Tomas Matejka

管理者、sq-ultimate、2件の返信.

プロフィールを表示

10年前 #136139

Open the existing EAW / code / CustomFunctions.mq4 and add this new function there

0

3件の返信を表示中 - 1 - 3件目 (全3件中)