[← Utils](../README.md) # Utils/Objects Chart-object utilities. Everything lives in `namespace TSN`. ## Main features - **Create objects in one call**: wrappers over `ObjectCreate` + `ObjectSet*` for lines, trends, channels, text, arrows, edit fields, buttons, rectangles, events and Fibonacci (`CNativeoGObjs`). All strings are `const string&`. - **Draw a trade box**: paint the TP and SL rectangles of a trade (`CObjGUtils::DrawTPSL`). - **Batch property change**: set one integer property on every object whose name starts with a prefix (`CObjGUtils::ModifiedIntegerPropertyByPrefix`). - **Scheduled deletion**: queue object names with an expiry time and let `OnNewBar` delete, hide or show them (`CGraphicObjEliminations`). - **Fibonacci helper**: define levels from strings, move the object and read the price of any level (`CFibbo`). - **Show / hide macros**: `HIDE_OBJECT` and `SHOW_OBJECT` toggle an object's visibility across timeframes. ## Basic usage ### Create objects ```mql5 TSN::CNativeoGObjs::VLineCreate(0, "entry_line", 0, TimeCurrent(), clrRed, STYLE_DASH, 1, false, true, true, "Entry"); // width, back, selection, ray, tooltip TSN::CNativeoGObjs::TextCreate(0, "lbl", 0, TimeCurrent(), SymbolInfoDouble(_Symbol, SYMBOL_BID), "Hello", "Arial", 8, clrWhite, 0.0, ANCHOR_CENTER); ``` ### Draw TP / SL ```mql5 TSN::CObjGUtils::DrawTPSL(0, 0, "trade1_", tp, sl, entry, time_entry, time_end, clrGreen, clrRed, true, 1, STYLE_SOLID); // fill, width, style ``` ### Delete objects later ```mql5 TSN::CGraphicObjEliminations g_del; g_del.Initilialize(0, 4, 4, 4); // chart id + three array reserves g_del.InitAddElement(TimeCurrent() + 3600); // objects added next are deleted after this time g_del.AddElement("entry_line"); g_del.AddElement("lbl"); // on every new bar g_del.OnNewBar(TimeCurrent()); ``` ### Fibonacci ```mql5 TSN::CFibbo fibbo; fibbo.Create(0, "fibo", 0, clrGold, STYLE_DOT, 1, "Fibo"); fibbo.SetLevels("0;0.5;0.618;1", "clrGray;clrGold;clrOrange;clrGray", STYLE_DOT, 1, ';'); fibbo.Move(time1, time2, price1, price2); double price = fibbo.GetLevelPrice(0.618); ``` > Only the most representative functions are shown here.