10
min

How the Pembe Strategy Editor works

start programming with a simple strategy

start programming with a simple strategy


Getting Started



The editor is the heart of the APP. The strategies can be developed there and a backtest can be carried out directly on historical data As a basis for developing the strategies, we use the open source Python module:

  • Backtrader

All functions of backtrader can be used. Here is the link to the official backtrader documentation:

The first class is always predefined in the editor:

  • class Testclasse_uWuWYxpq(backtrader.Strategy):

This is for simplification and rapid development of the strategy. It is possible to insert its indicators directly after the class. The first line in the editor should therefore not be changed.

Example

class SMA_10_50(backtrader.Strategy):

    def __init__(self):
        ma_fast = backtrader.ind.SMA(period=10)
        ma_slow = backtrader.ind.SMA(period=50)
        self.crossover = backtrader.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()

Class

class SMA_10_50(backtrader.Strategy):

The first line again defines the class in the same concept as described in 'Getting Started'

Strategy

def __init__(self):

The beginning of the strategy. the concept is described in this Backtrader documentary section:


Indicators

ma_fast = backtrader.ind.SMA(period=10
ma_slow = backtrader.ind.SMA(period=50
self.crossover = backtrader.ind.CrossOver(ma_fast, ma_slow)

This part of the code defines the indicators used. In this example, a simple moving average is used. how the indicators work is explained in the following section:

A list of all available predefined indicators with reference can be found here:

Orders

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

In the last part of the strategy, the orders are defined. A detailed description of the orders can be found here:

source:

Foto from Uriel SC 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.