Reputation: 348
What are strategy.long and strategy.short mean in pine script, what do they resemble in below code
strategy.entry("LONG", strategy.long, when = "some_condition")
strategy.close("LONG", when = "some_condition")
strategy.entry("SHORT", strategy.short, when = "some_condition")
strategy.close("SHORT", when = "some_condition")
Upvotes: 1
Views: 1529
Reputation: 1094
When you're flat, it means that you have no position. Position size = 0
When you go long you buy expect the price to go up and make a profit. Your position size is positive. You close/sell your position so that yourposition size becomes zero or flat.
When you go short, you sell (expecting price to go down), hence your position size becomes negative. You buy back later so that your position size becomes zero or flat again.
Hope that made sense.
Upvotes: 2