Decimal precision in custom watchlist column


Category:
0
0

I am running the following in a watchlist ; but I noticed that it doesn’t fire correctly for any security for which the price goes out 4 decimals or more. For example, TOS thinks /6J (Yen futures) Vwap is .0092 when it is actually .0091863. The difference is substantial.

Do you know of a fix for this?

 

plot VW = reference Vwap();

def shared_vwap_1 = VWAP();
def price = close;

addLabel(yes, VW);

AssignBackgroundColor( if price == shared_vwap_1 within 5 bars then color.CYAN else color.GRAY);

#end

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on May 10, 2021 8:14 pm
131 views
0
Private answer

The title of your question has been updated to make it easier for the rest of our viewers confronting this issue to locate this post using the search function. Your question was also moved out of the "Alerts and Notifications" topic and into the "Watch Lists" topic based on the context of your request.

The only workaround possible would be to multiply the value by 0.001, which "should" move the decimal point 3 places to the right. However even this does not end up computing what one would expect.

AddLabel(yes, VW * 0.001);

When you add that computation to the value displayed in the column we would expect to see it display a value of 9.1863. However when you apply that multiplier we find the value displayed is zero.

Anyone running across this post in the future should check to see if this issue still exists. And if so, submit a bug report to TD Ameritrade support.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 10, 2021 9:33 pm