compressing space between 0 to 1

mbarcala

Active member
Im working on an lower indicator and I would like to know how I can manipulate the space between 0 to 1 and 0 to -1, I think that it can be done using the Log function but I can't find examples of this idea. I have a picture here that show two indicators space, my is the one on the bottom and I would like to make the space between 0 to 1 as the one on the top.

 
Last edited:
Solution
Im working on an lower indicator and I would like to know how I can manipulate the space between 0 to 1 and 0 to -1, I think that it can be done using the Log function but I can't find examples of this idea. I have a picture here that show two indicators space, my is the one on the bottom and I would like to make the space between 0 to 1 as the one on the top.


Your post is confusing, i am not sure what you are wanting.

1. Do you currently have values that range from -0.5 to 0.5 ?
with a full height span of 1.0?

2. Do you want to rescale your numbers, so they go from -1 to 1 ?
the center line would be the same, 0.
so multiply your variable * 2.

3. Do you want to rescale your numbers so they go from...
Im working on an lower indicator and I would like to know how I can manipulate the space between 0 to 1 and 0 to -1, I think that it can be done using the Log function but I can't find examples of this idea. I have a picture here that show two indicators space, my is the one on the bottom and I would like to make the space between 0 to 1 as the one on the top.


Your post is confusing, i am not sure what you are wanting.

1. Do you currently have values that range from -0.5 to 0.5 ?
with a full height span of 1.0?

2. Do you want to rescale your numbers, so they go from -1 to 1 ?
the center line would be the same, 0.
so multiply your variable * 2.

3. Do you want to rescale your numbers so they go from 0 to 1?
This would have the same height as your original series, 1.
need to shift the center line to 0.5,
so add 0.5 to your variable.
 
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Your post is confusing, i am not sure what you are wanting.

1. Do you currently have values that range from -0.5 to 0.5 ?
with a full height span of 1.0?

2. Do you want to rescale your numbers, so they go from -1 to 1 ?
the center line would be the same, 0.
so multiply your variable * 2.

3. Do you want to rescale your numbers so they go from 0 to 1?
This would have the same height as your original series, 1.
need to shift the center line to 0.5,
so add 0.5 to your variable.
2. yes I want to rescale the numbers to go from 0 to 1. I'm using the stochasticFull but shows me 1 to far from 0 and I don't know how to de-scale that part. I don't have an idea how to code that part, can you show me a line so I can understand?

here is my code
Code:
declare lower;

input KPeriod = 20;
input slowing_period = 6;
input averageType = AverageType.EXPONENTIAL;

def lowest_k = Lowest(low, KPeriod);
def c1 = close - lowest_k;
def c2 = Highest(high, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, 3);

plot centerLine = 0;
 
Last edited:

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
214 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top