Plotting 4 decimal points instead of just two?

I

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:
I

Ian_Tai

New member
No. Removing Round caused a script error, but . . . Changing 2 to 4 solved. Good tip. Thanks.
 
horserider

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));
 
I

Ian_Tai

New member
Got it. Just so you know, I'm using that right alongside your Buy Sell volume indicator. Thanks for both..
 

Similar threads

Top