//+------------------------------------------------------------------+
//| Test_ExpertRemove.mq5 |
//| Copyright 2000-2024, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
input int ticks_to_close=20;// EA 언로드 전 틱의 수
//+------------------------------------------------------------------+
//| 엑스퍼트 초기화 해제 함수 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
Print(TimeCurrent(),": " ,__FUNCTION__," reason code = ",reason);
//--- "비움" 코멘트
Comment("");
//---
}
//+------------------------------------------------------------------+
//| 엑스퍼트 틱 함수 |
//+------------------------------------------------------------------+
void OnTick()
{
static int tick_counter=0;
//---
tick_counter++;
Comment("\nBefore unloading expert advisor ",__FILE__," 좌측",
(ticks_to_close-tick_counter)," 틱");
//--- 전
if(tick_counter>=ticks_to_close)
{
ExpertRemove();
Print(TimeCurrent(),": ",__FUNCTION__," 엑스퍼트 어드바이저는 언로드됩니다");
}
Print("tick_counter =",tick_counter);
//---
}
//+------------------------------------------------------------------+
|