Datafield Script Support

Hi guys - I am looking to search out companies which have been paying down their debt YoY.

I don’t think my results are working as expected - how does this script look. How does the period work [1] [2] how do you know if these are quarters or years:



Debt1 = Debt[1];

Debt2 = Debt[2];

DebtPaydown1yr = (( (Debt1-Debt2)/Debt2)*100);





Hi Mandeep,

Firstly with the [1][2] question. It is whatever the base chart is unless you have “changed” the time frame. ie if you add this script to a Daily chart than [1] will be the previous day and [2] will be 2 days back.

Remember that even if the DataField has Monthly data, it will still have a value for every day of the month if you add it to a daily chart.

The way to get around that is to change the time frame. eg

Debt = Month(DATAFIELD(FEED=FD, FIELD=TotalDebt));

Another way you can do it is to use the Change() function. In there you can specify that you want to go back a year and it is smart enough to look at the dates to do that.

Hope that helps


Thanks Mathew - on that basis I am using this:



((Debt - Debt[1]) / Debt[1] ) * 100


But when I use on a ASX 200 watchlist the cells are all 0. Is there an issue with this approach or maybe the data?