January 6, 2024
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
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()
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()
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()
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()
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()
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()
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