PDA

View Full Version : Unique Tags for Drawing/Text Objects


moflaherty
11-28-2008, 08:52 AM
Do you have a function for creating these? If not, I would like to recommend adding one to the API. I created this one which works for me:


private string GetUniqueTag()
{
return Guid.NewGuid().ToString();
}

NinjaTrader_Josh
11-28-2008, 12:50 PM
You can create unique tags just by adding CurrentBar to your tag string.

"name" + CurrentBar

moflaherty
11-29-2008, 10:49 AM
Actually, the whole point of my request is for things that I don't care to name. For those mundane text and objects that I don't care to track, I prefer to just set it to something guaranteed to be unique. Your suggestion makes me have to "think" and it convolutes the code. It creates additional complexity because in an indicator/strategy that has a lot of drawings/text, I could inadvertently use the same "name" + currentbar and create some debugging headaches. Something like a simple method guaranteed to be unique is "fire and forget".

Frankly, I would prefer you to overload all your methods and drop the tag, but I thought that was asking for too much. That is why I suggested something simpler.

Hopefully you see the difference.

NinjaTrader_Josh
11-29-2008, 01:59 PM
Thank you for the suggestion. I will forward it to development.

NinjaTrader_Ray
11-29-2008, 03:18 PM
You already answered your question, just using GUID, no even need to wrap it in a method...

DrawLine(Guid.NewGuid().ToString()....)

moflaherty
11-29-2008, 03:43 PM
It wasn't a question--just a suggestion.

{sigh}