For a few months, we have this new function available that allows us to store a note to a symbol. The description from DAS is not very clear, so I will try to explain how it is supposed to work and what real use case it can help you with.
setSymbolNote
the function is to be used with 3 parameters.
symbol
name of the note
value of the note
setSymbolNote("MSFT","MYNOTE","These are my notes for Microsoft today");
multiple notes are possible
setSymbolNote("MSFT","MYNOTE","These are my notes for Microsoft today");
setSymbolNote("MSFT","PATTERN","ORB");
dynamic names are possible as well
$MY1MINWINDOW=GetWindowObj("MY1MIN");
$MYSYMB=$MY1MINWINDOW.SYMBOL;
$MYTEMPNOTE=input("Input the note for "+$MYSYMB, "",10);
setvar($MYSYMB+_DAILYNOTE,$MYTEMPNOTE);
setSymbolNote($MYSYMB,"DAILYNOTE",$MYTEMPNOTE);
getSymbolNote
to retrieve the symbol note, use just 2 parameters
symbol
note name
$MYMSFTNOTE=getsymbolnote("MSFT","MYNOTE");
$MYMSFTNOTE=getsymbolnote("MSFT","PATTERN");
Variable parameters are also possible.
$NOTE=getsymbolnote($MYSYMBOL,"MYNOTE");
The note is always a string, so even if you put a number there it will be considered as a string, and you cannot do calculations with text strings. There is a work around that if you place the string into the montage price field and read it back, then your note becomes a number, and you can use it in calculations.
Convert to number
setsymbolnote("U","STOP","28.45");
$U_STOP=getsymbolnote("U","STOP");
$MONTAGE.price=$U_STOP;
$U_STOP_CONVERTED=$MONTAGE.price;
will give us
which allows us to calculate with the store note value.
Use cases
Apart from the traditional text notes, on the above example, it is practical to save your original entry stop for the position. Just add the setsymbolnote in your entry hotkey to store the trade properties.
That way if you lose the stop, or you need to adapt the position size with a hotkey after you took a partial, you can refer to the symbol note STOP and read it and calculate the new set of OCO orders or just a stop loss order.
If you combine it with the dynamic variable names I wrote about a few days back, the notes can be a good way to store some to-be-remembered information about your entries for all your positions.
Hi Peter, is there a way to delete all the notes from all the symbols at once?
I storage a checklist on each symbol as my setup checklist through symbol notes, but I would like the symbol notes to get deleted once I close the desktop. Any idea how could I do this? or any workaround you might think of?
Thanks