1

DLL を使用せずに MQL4/5 コード内から MetaTrader 4/5 で自動取引をグローバルに無効にするにはどうすればよいですか?

4

2 に答える 2

0

はい、MQL4/5 Expert Adviserこの方法で自分自身を取引することを局所的に禁止することができます:

if (  IsTradeAllowed() )
{     Comment( __FILE__, " [EA] Trading is allowed, will disable self." );
      ...
}
else
{    Comment( __FILE__, " [EA] Trading is not allowed, will disable self." );
     ...
}
// ---------------------------------------//   GRACEFULLY RELEASE ALL RESOURCES BEFORE FIN'd

// ********
// FINALLY:    EXPERT-ADVISOR SIG_TERM -> self ( MT4 )
   ExpertRemove();                        /*     MT4 The Expert Advisor
                                                     is not stopped immediately
                                                     as you call ExpertRemove();
                                                     just a flag to stop the EA operation is set.
                                                     That is:
                                                     - any next event won't be processed,
                                                     - OnDeinit() will be called
                                                     and
                                                     - the Expert Advisor will be unloaded and removed from the chart.
                                                 */
于 2016-06-04T17:39:37.400 に答える