Can you help me understand why and how to fix this problem?
Posted: Mon Sep 11, 2023 8:19 pm
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)
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)