#Barstate.islast value Converted to a normal Constant Int value that is true on all bars.

1 messages · Page 1 of 1 (latest)

fast sedge
#

the islast is true on the last bar, not sure what u want thou... can u explain more?

#

u can detect the x-lastth-candle, is that what u want?

#

okey, i get it now. yes, ta.XY() requier a constant rather then a series

#

but thsi is also true on the last bar

#

not sure why u mentioning barstate.islast

#

it doesnt do that on barstate.islast in the first place... i think u mix up things here

#

barstate.islast is not "special" in the sense of reading variables

#

but what u want is to enter XY varaibles into indicator calculations like SMA and EMA, right? so they can be variable

#

not constant

#

yes

#

i know what u mean, but they are still the same on the last bar 😛

#

so that what was confusing me

#

ur mixxing up barstate.islast... this variable is only here to detect when u are on the last bar... has nothing to do with constants or anything

#

yes, tahts because pine runs the WHOLE script on every bar... but if u do "barstate.islast" this part is only run on the last bar

#

so only once

#

thats why its much faster

#

yes i do, BUT it still needs a constant

#

SMA and EMA still need a constant

#

and u want it to be dynamic, right?

#

not if the code is in barstate.islast

#

u can never put an array value into ta.sma(), never. not on barstate.islast and not anywhere else becasue it needs a "simple int"

#

so what u want has nothing to do with barstate.islast in my eyes

#

but what u want is still a valid question

#

or yes i dont understand, thats true

#

but then what u want may still be possible already? so ew can figure it out

#

they watch over this

#

if u want we can talk more about this and u can tell me what u want and maybe its already possible?

#

so u want

ta.ema(close, 1)
ta.ema(close, 2)
ta.ema(close, 3)
...

#

right?

#

in a loop?

#

for sure

#

#🌲┃pine-script

#

i think u can post pictures there

#

or here?

#

sure

#

im looking at the indicator right now

#

yes, u want to loop through all and filter out the best

#

is basicly what kioseff does

#

BUT i have to say, i dont think thats possible, im thinking of how he did this

#

but the reason its not possible is not the table thing

#

its becasue it needs to be a simple int

#

thats the ONLY reason

#

and yes, you are correct, they need to be manually inputed

#

no im pretty sure im not wrong here

#

i can write u a testscript

#

that shows it very clear

#

hmm

#

not sure what to do with this now lol, im pretty sure im right, it needs to be a simple int in ANY TA. indicator

#

it seems u are correct, i can loop through sma's now (i didnt know), so whats the problem now?

#

so okey, now you want to take a value from an outside script to put it into yours, right?

#

thats the feature?