Abhinav Manthri
Abhinav Manthri

Reputation: 348

Long/Short strategies in Pine script

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

Answers (1)

bbnm
bbnm

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

Related Questions