Error “expected double”


Category:
0
0

Hello,

I am trying to add a custom column on a watchlist but I am getting error “expected double”. I am not able to figure out what I am doing wrong. Here’s the code below..

input vpriceType = PriceType.MARK;

plot plot_name;

if (GetSymbol() == “EDIT”) then {

if ((((21.32 – 20.13 ) * 1.0 ) + 21.32) <= vpricetype)

then { plot_name = 1.1; }

else if ((((21.32 – 20.13 ) * 2.0 ) + 21.32) <= vpricetype) then { plot_name = 2.1; }

else if ((((21.32 – 20.13 ) * 3.0 ) + 21.32) <= vpricetype) then { plot_name = 3.1; }

else if ((((21.32 – 20.13 ) * 4.0 ) + 21.32) <= vpricetype) then { plot_name = 4.1; }

else if ((((21.32 – 20.13 ) * 5.0 ) + 21.32) <= vpricetype) then { plot_name = 5.1; }

else { plot_name = 0.0; }}

else if (GetSymbol() == “AMD”)

then { plot_name = 2.1; }

else { plot_name = 0.0; };

 

 

Attachments:
Marked as spam
Posted by (Questions: 7, Answers: 8)
Asked on March 4, 2019 2:12 pm
325 views
0
Private answer

Simplify you code in order to properly trouble shoot it.

input vpriceType = PriceType.MARK;
plot plot_name = vpriceType;

You will find this reveals where the error is being generated. You seem to be trying to grab the current MARK price from the charted symbol, through the input parameter named vpriceType. However if you try to plot that value you will find it does not result in a numeric (double) value.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on April 5, 2019 8:21 am