Plotting 4 decimal points instead of just two?

Ian_Tai

New member
Hello all -

I've lately been interested in range and when to take profit and when to accept a loss. I found someone else's indicator that compares Day Range to ATR in a label format that I would like to use. But, it only plots two decimals. Not effective for FX trading. I'll post the code below. Would appreciate a tip. Thanks.

Code:
##### TS ATR
##### Made By Leonard
##### Version 1
##### 4/23/2015
##### Copyright Leonard Tulko 2014 - 2015 All rights reserved
##### This software is licensed for individual use only.


declare upper;

input ATRLength = 14;
input averagetype = AverageType.WILDERS;
input BasePeriod = AggregationPeriod.DAY;
input showlabel = yes;

def ATR = MovingAverage (averagetype, TrueRange(high(period = BasePeriod)[1], close(period = BasePeriod)[1], low(period = BasePeriod)[1]), ATRLength);

def Today_High = Highest(high(period = baseperiod)[0], 1);
def Today_Low = Lowest(low(period =baseperiod)[0], 1);

def DR = Today_High - Today_Low;

AddLabel(showlabel, "DayRange: " + Round(DR , 2) + " - ATR:" +round(ATR,2));
 
Last edited by a moderator:

horserider

Well-known member
VIP
Glad you got what you want. You are telling it to round to 4 digits. So when you removed round but not the # of digits to round to it gave the error.
I should have been clearer in my previous answer.
AddLabel(showlabel, "DayRange: " + (DR ) + " - ATR:" +(ATR));
 

bmcgraw393

New member
VIP
Does anyone know how to output a specific amount of decimal places? Thinkorswm talks about using the Numberformat function, but that doesnt seem to work. For instance I want this output to show 5 decimal places:
def SMA = Average(price[-displace], length);
plot zero=0;
plot output=((SMA-SMA[1])/close)*100;

ive tried using round, but that doesnt seem to help. I can't find any docs to help.
Any help would be great, thank you!
 

Similar threads

Top