> For the complete documentation index, see [llms.txt](https://invsto.gitbook.io/orca/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://invsto.gitbook.io/orca/writing-strategies/02.-long-only-or-short-only-strategy.md).

# 02. Long and Short Strategies

A strategy can be long-only, short-only or can consist of both long and short trades.

A long-only strategy is when you enter the trade with a BUY signal and you exit the trade with a SELL or a CLOSE signal. It means that you are always buying first and then exiting later.

Let's check out how to write a long-only strategy with Orca.&#x20;

```
def process_candle(self):
       if <entry_criteria>:
            self.buy(info="Enter Buy and Hold", quantity=1)

        if <exit criteria>:
            self.close(info="Exit Buy and Hold", quantity=1)
```

In the above code, you are entering with some entry criteria and you are exiting with a close criteria. A simple buy and hold is a good example of long-only strategy

A short-only strategy is the opposite of a long-only strategy, which means that you sell first and then buy later.&#x20;

```
def process_candle(self):
       if <entry_criteria>:
            self.sell(info="Enter short", quantity=1)

        if <exit criteria>:
            self.close(info="Exit short", quantity=1)
```

In the above code, you are entering a short position on entry criteria and you are exiting the trade by having a close or BUY signal. This is a simple example of short-only strategy.

Now let's take a look at a strategy that can have both long and short signals.

```
def process_candle(self):
       if <entry_criteria 1>:
            self.buy(info="Enter short", quantity=1)
            
       if <entry_criteria 2>:
            self.sell(info="Enter short", quantity=1)

        if <exit criteria 1 >:
            self.sell(info="Exit short", quantity=1)
            
        if <exit criteria 2 >:
            self.buy(info="Exit short", quantity=1)
```

In the above code, on entering the first entry criteria, you are entering into a long position and on the second entry criteria, you are entering into a short position. On the exit criteria 1 and 2, you are exiting the previously entered long and short positions. This way, you are closing the trade with both long and short signals.
