hi.
After selling, he will buy when it rises by %BUY from the last bar to the instant value.
After buying, it will sell when it drops by %SALES from the most recently bought bar to the instant value.
it will sell when it goes down 3% after the last buy trade (from the lowest bar), and buy when it goes up 2% after the last sell trade (from the highest bar).
I don't want to go back 7 bars. Using the "barsince" command, I want to go to the most recently traded bar.
After selling, he will buy when it rises by %BUY from the last bar to the instant value.
After buying, it will sell when it drops by %SALES from the most recently bought bar to the instant value.
it will sell when it goes down 3% after the last buy trade (from the lowest bar), and buy when it goes up 2% after the last sell trade (from the highest bar).
I don't want to go back 7 bars. Using the "barsince" command, I want to go to the most recently traded bar.
study("My_Proje", shorttitle="AHAP", overlay=false)
length=input(7)
get_buy=input(3)
get_sell=input(3)
highest_peak=highest(length)
bottom_hole=lowest(length)
buy=close>bottom_hole+(bottom_hole/100*get_buy)?1:0
sell=close<highest_peak-(highest_peak/100*get_sell)?1:0
plot(buy,color=green)
plot(sell, color=red)
I tried to do it, it didn't work. Because I need to add barssince command. This command always gave an error. I would be glad if you help.
Thanks in advance. . .