hi,
I am new here. I have little knowledge of python coding. I want an algorithm for sma20 and sma50 crossover. I want to select only 2 stocks: AAPL and TSLA. I want tgt_percentage = 0.01, and stoploss_percentage = 0.01, it means risk/reward = 1/1.
can anyone help me to write this algorithm? I have written it as
from quantopian.pipeline import Pipeline
from quantopian.pipeline.filters import QTradableStocksUS
from quantopian.research import prices, symbols
from quantopian.pipeline.data import EquityPricing
from quantopian.pipeline.domain import US_EQUITIES
from quantopian.research import run_pipeline
from quantopian.pipeline.factors import SimpleMovingAverage
pipe = Pipeline(
columns={
'price': EquityPricing.close.latest,
'volume': EquityPricing.volume.latest,
'sma20': SimpleMovingAverage(inputs=[EquityPricing.close], window_length=20),
'sma50': SimpleMovingAverage(inputs=[EquityPricing.close], window_length=50),
},
domain=US_EQUITIES,
)
result = run_pipeline(pipe, '2016-01-15', '2019-06-01')
result.tail()
please assist me in how to write the whole algorithm for the above-said strategy.