Chart Elements

Hey guys,

I was wondering if someone can point me in the right direction, I would like to have an indication on a Chart using something like a chart element True/False box, that will show a percentage of how far +/- the current close is from my buy price.

I have been playing with chart elements but i can’t work out how to achieve this. I can get fields from fundamental data, that change as I bring up a new code (I have saved a page layout for this) but what I would like to do is have a single stock fixed to its buy price if that makes sense.

I apologise if I’m not explaining my self very well. But essentially I would like something that is easily visual on the chart without having to go back to a watch list or my P & L to reference the % of change.

I have also tried with price alert, but would like to visually clear up the chart so I don’t have lines and markers all over the place, just a neat box on the corner with the info in it.

Any help would be great

Cheers

Hi Raeburne,

If I understand you correctly, you would like a script or Tool in which you can set your buy price and then have the ± percentage difference to the current close price displayed using a Chart Element.

The primary issue I see is your requirement is that there is, to my knowledge at least, no Scripting function that will allow the entry of a price through the Properties of the Script, without opening and changing a variable value within the script code itself - not a desirable necessity.

What you desire can be done reasonably easily using a Optuma Pascal Custom Tool, but that means you need the Optuma Programming Module and a knowledge of Pascal, which I’m assuming from the nature of your question you do not have.

Cheers

Trevor

The Auld Tyma at

Auld Tyma Data Logo with URL 1 cm

 

Heres my code I use for a stop loss. Maybe you can use this as your starting point and instead of the stop price it’s your buy price.

I made a user defined script for the Stop Level and then use DATAFIELD to pull those numbers in.

 

Script Name: Price vs Stop

(LAST() - DATAFIELD(FEED=UD, FIELD=Stop_Level) )/ LAST()

Hi Raeburne,

One thing to look at is User Defined Fields in a Watch list. What you can do is have a watchlist with all the codes you have a position in and then in the Watchlist type in your buy price.

That User Defined Fields is then available in scripting like any other fundamental field and you can script against that using the DataField() function.

Matt Humphreys did a couple articles on this - have a look at this and let us know if that does not do what you need.

https://www.optuma.com/working-with-edfs-part1/

Hope that helps

Mathew

The second part of his post covers the scripting with the fields.

https://www.optuma.com/working-with-edfs-part-2/

Thanks everyone for your help, really appreciate the assistance.

I’ll have a look and work through the articles Mathew has posted and see how I get on.

Cheers

 

Hi Raeburne,

One additional note, if you have access to the current v1.5 beta, there is a new script function available called NEARESTALERT() which maybe of use to achieve the result you are after.

If your buy price is setup in your Alerts you can now make reference to it in scripting.

Here is an example using the Chart Element tool:

AlertExample2

You can see the Close is 1.31% away from the Alert line. The script used for this was:

P1 = CLOSE() ;
P2 = NEARESTALERT(TYPE=Lower);
ABS(P2-P1) /P1

For more information on this feature please refer to the following article: https://help.optuma.com/kb/faq.php?id=1104