Trontz17

Another Simple Strategy

Trontz17 Aktualisiert   
AMEX:SPY   SPDR S&P 500 ETF TRUST
SPY

This one will be published. I chose not to publish the last one because I felt it wasn't ready. I am glad I waited. This will be continually updated, but I now use this in live trading. I stand by the reliability of this strategy, and I highly recommend it be used on a 15 min chart. This is really only for day traders. Feel free to adjust the settings to your liking, but I am happy with the defaults. Once again, if you have any questions, feel free to reach out. This script could not have been written without the help of a master pine editor, kodify, who has published many guides to pine script editing, Thanks to him.https://kodify.net/tradingview-programming-articles/



//@version=4
strategy(title="RSI Crossover Strategy", shorttitle="RSIS", overlay=true, pyramiding=4, default_qty_type=strategy.percent_of_equity, default_qty_value=20, calc_on_order_fills=true, initial_capital=5000)
// Make input options that configure backtest date range
startDate = input(title="Start Date", type=input.integer,
defval=1, minval=1, maxval=31)
startMonth = input(title="Start Month", type=input.integer,
defval=1, minval=1, maxval=12)
startYear = input(title="Start Year", type=input.integer,
defval=2020, minval=1800, maxval=2100)

endDate = input(title="End Date", type=input.integer,
defval=1, minval=1, maxval=31)
endMonth = input(title="End Month", type=input.integer,
defval=7, minval=1, maxval=12)
endYear = input(title="End Year", type=input.integer,
defval=2020, minval=1800, maxval=2100)

// Look if the close time of the current bar
// falls inside the date range
inDateRange = (time >= timestamp(syminfo.timezone, startYear,
startMonth, startDate, 0, 0)) and
(time < timestamp(syminfo.timezone, endYear, endMonth, endDate, 0, 0))
c = crossover(rsi(14, close), sma(rsi(14, close), 7))
d = crossunder(rsi(14, close), sma(rsi(14, close), 7))
a = close>high and c
b = close<low and d
plotshape(c, style=shape.xcross, location=location.belowbar, color=color.green)
plotshape(d, style=shape.xcross, location=location.abovebar, color=color.red)

longCondition = d
if (inDateRange and longCondition)
strategy.entry("Buy", strategy.long)
if c and strategy.opentrades>0
strategy.close("Buy")
shortCondition = c
if (inDateRange and shortCondition)
strategy.entry("Short", strategy.short)
if d and strategy.opentrades<0
strategy.close("Short")
Kommentar:
Also, this script includes an input option for selecting a date range. Feel free to modify tthis in the input box to backtest any specific time frame you wish. I personally only included from 1/1/2020 to present because this has been a volatile year and if any strategy is going to work, I would want to know it works best during volatile, unpredictable times. Enjoy!
Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.