I created my own indicator line (like a moving average) that I call "PN" and I want to use this PN value for determining whether to get in or out of a trade. When I am looking to enter a trade I want to Go Long when the current price is above the value of PN in the previous bar, which I call as PN[1]. Once I am Long the trade I want to exit when the current price drops below the PN in the previous bar PN[1].
Although the strategy works alright for entering the trade it does not exit where I think it should. From the plot of the strategy, it looks like when I tell it to exit the trade when the price falls below PN[1], instead it will only exit the trade when the price eventually falls below the PN[1] where I entered the trade.
Shouldn't PN[1] always refer to the previous bar value no matter what bar you are currently in? I am at a complete loss on why this is happening. Is there something I am missing or don't understand about my indicator or how it can be used? Any help would be appreciated.
Comment