Make the format=1.2 become variable depends on the stock price

#1
As there are different price with different spread for trading, so the number of decimal I have to show is different for each stock. I write the following hopefully, when it shows in explore or scan the display is corrcetly show the number of decimal, but I do not want to make it so many decimal places even for large stock price.

please help me on below AFL which gives error: (wrong format)

SpreadDecimal = IIf(C<0.5, StrToNum("1.3"),StrToNum("1.2"));
AddColumn(C,"Close",SpreadDecimal);

Thanks!
 

trash

Well-Known Member
#2
As there are different price with different spread for trading, so the number of decimal I have to show is different for each stock. I write the following hopefully, when it shows in explore or scan the display is corrcetly show the number of decimal, but I do not want to make it so many decimal places even for large stock price.

please help me on below AFL which gives error: (wrong format)

SpreadDecimal = IIf(C<0.5, StrToNum("1.3"),StrToNum("1.2"));
AddColumn(C,"Close",SpreadDecimal);

Thanks!
Because Close is an array. But format has to be a number as the error message tells you!

Code:
SpreadDecimal = IIf( LastValue( C ) < 0.5, 1.3, 1.2 );
AddColumn( C, "Close", SpreadDecimal );
 
#3
Because Close is an array. But format has to be a number as the error message tells you!

Code:
SpreadDecimal = IIf( LastValue( C ) < 0.5, 1.3, 1.2 );
AddColumn( C, "Close", SpreadDecimal );
Thanks, you are always helpful. I am just novice to programming. thx again.
 

Similar threads

Trade in Rs 20, No more % brokerage

Name:Phone:
Email:City:
State:
Are you a day trader?