//+------------------------------------------------------------------+ //| Far-TestObjDelete.mq4 | //| Copyright 2016, MetaQuotes Software Corp. | //| http://my.pdhost.net/cart.php | //+------------------------------------------------------------------+ #property copyright "Copyright 2014-2016, PersiansDream Informatics Group" #property link "http://my.pdhost.net/cart.php" #property version "1.00" #property strict #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping Print((string)__LINE__+"-OnInit Executed."); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- int ObjCount = ObjectsTotal(ChartID(),/*0=main subwindow*/0,/*all objectTypes*/-1); bool deleteResult=ObjectDelete(ChartID(),"non existing object"); Print(__LINE__,"-",deleteResult," | ObjCount=",ObjCount); //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+