15
min

Basic Sample Strategies for the Pembe Editor

A basic list of example strategies for the Pembe editor

A basic list of example strategies for the Pembe editor

This article lists some sample strategies that can be easily applied in the backtesting area. You just have to copy everything after the first line into the editor. The 'class' should not be copied. The Pembe editor generates these automatically and puts a class in the first line. The strategy can then be tested on historical data. The strategies are simple sample strategies, for active live trading these should be optimized if possible. For more details please have a look at: https://pembe.webflow.io/blog/how-the-pembe-strategie-editor-works


### SimpleMovingAverage ###

### 10-50 SMA ###

class MaCrossStrategy(bt.Strategy):


### copy this into the Pembe Editor ###

    def __init__(self):
        ma_fast = bt.ind.SMA(period=10)
        ma_slow = bt.ind.SMA(period=50)
       self.crossover = bt.ind.CrossOver(ma_fast, ma_slow)


   def next(self):

        if not self.position:
            if self.crossover > 0:
                self.buy()
        elif self.crossover < 0:
            self.close()

### ExponentialMovingAverage ###

### 5-8-13 EMA ###

class MaCrossStrategy(bt.Strategy):

### copy this into the Pembe Editor ###

    def __init__(self):
        ma_fast = bt.ind.EMA(period=5)
        ma_mid = bt.ind.EMA(period=8)
        ma_slow = bt.ind.EMA(period=13
        self.crossover = bt.ind.CrossOver(ma_fast, ma_slow, ma_mid)

    def next(self):

        if not self.position:
            if self.crossover > 0:
                self.buy()
        elif self.crossover < 0:
            self.close()

### TripleExponentialMovingAverage ###

### 5-8-13 TEMA ###

class MaCrossStrategy(bt.Strategy):

### copy this into the Pembe Editor ###

   def __init__(self):
        ma_fast = bt.ind.TEMA(period=5)
        ma_mid = bt.ind.TEMA(period=8)
        ma_slow = bt.ind.TEMA(period=13)
        self.crossover = bt.ind.CrossOver(ma_fast, ma_slow, ma_mid)

    def next(self):
        if not self.position:
            if self.crossover > 0:
                self.buy()
        elif self.crossover < 0:
            self.close()


### SmoothedMovingAverage ###

### 5-8-13 SMMA ###

class MaCrossStrategy(bt.Strategy):

### copy this into the Pembe Editor ###

    def __init__(self):
        ma_fast = bt.ind.SMMA(period=5)
        ma_mid = bt.ind.SMMA(period=8)
        ma_slow = bt.ind.SMMA(period=13)
        self.crossover = bt.ind.CrossOver(ma_fast, ma_slow, ma_mid)

    def next(self):
        if not self.position:
            if self.crossover > 0:
                self.buy()
        elif self.crossover < 0:
            self.close()

### HullMovingAverage ###

### 5-8-13 HMA ###

class MaCrossStrategy(bt.Strategy):

### copy this into the Pembe Editor ###

    def __init__(self):
        ma_fast = bt.ind.HMA(period=5)
        ma_mid = bt.ind.HMA(period=8)
        ma_slow = bt.ind.HMA(period=13)
        self.crossover = bt.ind.CrossOver(ma_fast, ma_slow, ma_mid)

    def next(self):
        if not self.position:
            if self.crossover > 0:
                self.buy()
        elif self.crossover < 0:
            self.close()


### DoubleExponentialMovingAverage ###

### 5-8-13 DEMA ###

class MaCrossStrategy(bt.Strategy):

### copy this into the Pembe Editor ###

    def __init__(self):
        ma_fast = bt.ind.DEMA(period=5)
        ma_mid = bt.ind.DEMA(period=8)
        ma_slow = bt.ind.DEMA(period=13)
        self.crossover = bt.ind.CrossOver(ma_fast, ma_slow, ma_mid)

    def next(self):
        if not self.position:
            if self.crossover > 0:
                self.buy()
        elif self.crossover < 0:
            self.close()

### DicksonMovingAverage ###

### 5-8-13 DMA ###


class MaCrossStrategy(bt.Strategy):

### copy this into the Pembe Editor ###

    def __init__(self):
        ma_fast = bt.ind.DMA(period=5)
        ma_mid = bt.ind.DMA(period=8)
        ma_slow = bt.ind.DMA(period=13)
        self.crossover = bt.ind.CrossOver(ma_fast, ma_slow, ma_mid)

    def next(self):
        if not self.position:
            if self.crossover > 0:
                self.buy()
        elif self.crossover < 0:
            self.close()



Source:
Foto from charlesdeluvio at Unsplash

Who we are?

Get into algorithmic trading with PEMBE.io!

We are providing you an algorithmic trading solution where you can create your own trading strategy.
Mockup

Algorithmic Trading SaaS Solution

We have built the value chain for algorithmic trading. Write in native python code in our live-editor. Use our integrated historical price data in OHLCV for a bunch of cryptocurrencies. We store over 10years of crypto data for you. Backtest your strategy if it runs profitable or not, generate with one click a performance sheet with over 200+ KPIs, paper trade and live trading on 3 crypto exchanges.