Page 1 of 1

Can you help me understand why and how to fix this problem?

Posted: Mon Sep 11, 2023 8:19 pm
by REYLO
i have applied this LINE code to my strategy script and i draws the line exactly how i wanted, the problem is when I try to use the my_buyLine for an entry confluence, I get an error.

Can you help me understand why and how to fix this problem?

I have attempted to figure it out by researching more information about LINES but I haven't had any success, please forgive my ignorance, I am a beginner pine coder.

thank you in advance,enter image description here Rey Lopez my Telegram: Rey Lopez #4360184

i have tried researching information about LINES and also tried looking at other peoples scripts to see if they have a similar coding but i have not had any success.

here is the piece of my code:

has_trendline_cross_over_happened = if(upos > upos[1])
1
else
0

bar_index_when_cross_over_happened = ta.valuewhen(has_trendline_cross_over_happened, bar_index, 0)

high_value_when_cross_over_happened = ta.valuewhen(has_trendline_cross_over_happened, high, 0)

my_buyLine = line.new(bar_index_when_cross_over_happened, high_value_when_cross_over_happened, bar_index_when_cross_over_happened+1, high_value_when_cross_over_happened, color= color.aqua, extend = extend.right)

line.delete(my_buyLine[1])

if ta.crossover(close, my_buyLine)
strategy.entry("buy", strategy.long)

Re: Can you help me understand why and how to fix this problem?

Posted: Mon Sep 18, 2023 2:54 am
by Rocky
I think it would be easier for you to create boolean triggers based on the specific variables that make up your Line.
Then, you would have true or false...long or short.....triggers....and you can get rid of the word line entirely.
Keep it simple.
I hope that helps.