Gold Futures Intraday Strategy

barbaros

Administrator
Staff member
Alright, final conversion from https://relaxedtrader.com/day-trading-gold/

Trade gold futures with this strategy intraday. Winrate is low but 85% gain this year with 3.2 profit factor.

Code:
// Gold Futures Intraday Strategy
// Free for use. Header credits must be included when any form of the code included in this package is used.
// v1.0 - barbaros - converted for b4signals.com

//@version=5
strategy("Gold Futures Intraday Strategy", "Gold Futures Strat", overlay=true, initial_capital=5000)

BarInSession(sess) => nz(time(timeframe.period, sess, "America/New_York")) != 0
ex_time = BarInSession("1415-1815")

BuySignal = strategy.position_size == 0 and close > ta.sma(close, 13) and dayofweek == dayofweek.friday and (not ex_time[1] and ex_time)
BuyExit = strategy.position_size > 0 and ((ex_time[1] and not ex_time) or (dayofweek != dayofweek.friday))

plotshape(BuySignal, text="Buy", style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.black)

strategy.entry("LE", strategy.long, 1, when = BuySignal)
strategy.close_all(BuyExit)

ai1iAf3.png
 
Top