Search found 16 matches

Go to advanced search

by Alex100
Mon Apr 18, 2022 4:30 pm
Forum: Pine Script Q&A
Topic: Set a fixed 0 to 100 range for a plotted line
Replies: 5
Views: 2774
 
Jump to post

Re: Set a fixed 0 to 100 range for a plotted line

Thank you for taking the time to write the code! I'm happy to hear you've also learned new things about arrays. > So you need the whole line with all its historic values? Definitely yes, as I look at trends, divergences, etc. > Wouldnt it be possible to manual input all max and min values? For ten ...
by Alex100
Sat Apr 16, 2022 2:40 pm
Forum: Pine Script Q&A
Topic: Set a fixed 0 to 100 range for a plotted line
Replies: 5
Views: 2774
 
Jump to post

Re: Set a fixed 0 to 100 range for a plotted line

Thank you for your answer, Shenpai! > If I understood you right, the problem is that in older bars pine does not know the future absolute high and low. Yes, you are right. In regards to your second and third ideas, they may work from a visual point of view, but it's not what I'm looking for. In sho...
by Alex100
Wed Apr 13, 2022 8:08 pm
Forum: Pine Script Q&A
Topic: Set a fixed 0 to 100 range for a plotted line
Replies: 5
Views: 2774
 
Jump to post

Set a fixed 0 to 100 range for a plotted line

Is it possible to change a plotted indicator line so that it will always fluctuate in an exact range, say 0 to 100 ? As an example, here's this basic script that plots the difference between a stock closing in green, or in red. //@version=5 indicator("My Script") var n = 0 if (close > close[1]) n +...
by Alex100
Wed Mar 30, 2022 1:39 pm
Forum: Pine Script Q&A
Topic: Call a function from inside a loop
Replies: 8
Views: 1917
 
Jump to post

Re: Call a function from inside a loop

Works great, thank you very much!
by Alex100
Tue Mar 29, 2022 1:57 pm
Forum: Pine Script Q&A
Topic: Call a function from inside a loop
Replies: 8
Views: 1917
 
Jump to post

Re: Call a function from inside a loop

Since I first posted my initial question, I did find a better solution that I used to replace this function, so I no longer have any code for it. But to give you a basic example, the function can calculate the percentage of a number from another number. And in case you need something like this in m...
by Alex100
Sun Mar 27, 2022 6:53 pm
Forum: Pine Script Q&A
Topic: Call a function from inside a loop
Replies: 8
Views: 1917
 
Jump to post

Re: Call a function from inside a loop

Ok, I no longer receive the two errors in my previous message, but a new one is showing up now, and I can't get rid of it: line 11: Syntax error I don't see any syntax error on line 11 (which is 'result := 1.0'), so what am I doing wrong? The code is this: //@version=5 indicator("My function") floa...
by Alex100
Sat Mar 26, 2022 3:55 pm
Forum: Pine Script Q&A
Topic: Call a function from inside a loop
Replies: 8
Views: 1917
 
Jump to post

Re: Call a function from inside a loop

I already tried to declare the 'result' variable, but I still received an error. If I declare it at the top of the script I get this error... Shadowing variable 'result' which exists in parent scope. and if I declare it right beneath the 'for' instruction, I get this one... 'result' is already defi...
by Alex100
Wed Mar 23, 2022 1:47 pm
Forum: Pine Script Q&A
Topic: Call a function from inside a loop
Replies: 8
Views: 1917
 
Jump to post

Call a function from inside a loop

I'd like to call a function from inside a 'for' loop. I wrote the code below, but I get an 'undeclared identifier' error. I tried lots of things to make it run, but couldn't find any solution. Can someone please help me? Alex //@version=5 indicator("My function") my_function(i) => // code here... [...
by Alex100
Wed Mar 16, 2022 9:37 pm
Forum: Pine Script Q&A
Topic: Small popup box on mouse hover
Replies: 9
Views: 1939
 
Jump to post

Re: Small popup box on mouse hover

Here's an example... // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © processingclouds //@version=5 indicator("Invisible Friend", "High Low Average", overlay=true, scale= scale.left) plot(math.avg(high,low), "A", color.new(color.blac...
by Alex100
Wed Mar 16, 2022 7:39 am
Forum: Pine Script Q&A
Topic: Small popup box on mouse hover
Replies: 9
Views: 1939
 
Jump to post

Re: Small popup box on mouse hover

Yes, this is good, but I'm wondering if it's possible to set a left scale for your indicator, and a right scale for the other indicator of the script (which is actually the main indicator line I'm watching). I added your code to my script, and while it did show the HL average in the top-left corner...

Go to advanced search