Top FREE TradingView strategy this week!

To make our community more profitable we decided to start a series in which we will review open-source TradingView strategies. The aim of the review is to select a strategy (or a number of strategies) from TradingView and run a reality check on it, optimize them and convert them into alerts, so you can set it up as a bot on WunderTrading platform.

Forex Master - free TradingView strategy

What we will provide

  • Open-strategy source

  • Strategy adjustment for particular exchange, pair, and timeframe

  • Backtest

  • Revised study script that you can apply in WunderTrading platform for bot trading.

    This week we found a nice strategy for a 30 min timeframe. The original idea was taken from: Koi_Capital. Originally, this strategy was applied to a forex pair EUR/USD. Our team made some adjustment and improvements and we are happy to present this work to you.

    You will find the strategy code here: Forex Master v4.0.

    IMPORTANT!

    • This is a trend strategy and works better in the uptrend

    • This strategy is only working for long positions

    • We added the trend identifier using the EMA and SMA interaction

    • Take profit and stop loss levels were converted into percentage

    • We added inputs for the period selection, so you could see how the strategy is performing on a monthly basis.

    Settings – Applicable to FTX: BTC-PERP 30 min

Variable

Value

Period

33

Length

17

Mult

1.7

ADX Smoothing

1

DI Length

77

Smoothed ADX1

7

Smoothed ADX2

14

Long Take Profit %

6.4

Long Stop Loss%

4.2

Revised strategy script code

You can copy this code and paste it into your TradingView.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Wunderbit Trading

//@version=4

strategy("Forex Master v4.0", overlay=true, pyramiding=0, commission_type=strategy.commission.percent, commission_value=0.07, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)

Price = close

ribbon_period = input(33, "Period", step=1)

leadLine1 = ema(close, ribbon_period)
leadLine2 = sma(close, ribbon_period)

p1 = plot(leadLine1, color= #53b987, title="EMA", transp = 50, linewidth = 1)
p2 = plot(leadLine2, color= #eb4d5c, title="SMA", transp = 50, linewidth = 1)
fill(p1, p2, transp = 60, color = leadLine1 > leadLine2 ? #53b987 : #eb4d5c)

Length = input(17, step=1)
Mult = input(1.7, step=0.1)
Basis = sma(Price, Length)
StdDev = Mult * stdev(Price, Length)
Upper = Basis + StdDev
Lower = Basis - StdDev

adxlen = input(1, title="ADX Smoothing")
dilen = input(77, title="DI Length")
dirmov(len) =>
up = change(high)
down = -change(low)
truerange = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
[plus, minus]

adx(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
[adx, plus, minus]

[sig, up, down] = adx(dilen, adxlen)

// plot(sig, color=color.red, title="ADX")
// plot(up, color=color.blue, title="+DI")
// plot(down, color=color.orange, title="-DI")

SmoothedADX1 = ema(sig, input(7))
SmoothedADX2 = ema(sig, input(14))


long_tp_inp = input(6.4, title='Long Take Profit %', step=0.1)/100
long_sl_inp = input(4.2, title='Long Stop Loss %', step=0.1)/100

long_take_level = strategy.position_avg_price * (1 + long_tp_inp)
long_stop_level = strategy.position_avg_price * (1 - long_sl_inp)


entry_long = crossover(Price, Lower) and SmoothedADX1 < SmoothedADX2 and leadLine2<leadLine1
exit_long = crossunder(Price, Upper) and SmoothedADX1 < SmoothedADX2 and leadLine2>leadLine1


////// BACKTEST PERIOD ///////
testStartYear = input(2019, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)

testStopYear = input(9999, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(31, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)

testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false


if testPeriod()
strategy.entry("LongEntry", true, when = entry_long, comment="Enter Long")
strategy.exit("LongExit", "LongEntry", limit = long_take_level, stop = long_stop_level)
strategy.close("LongEntry", when=exit_long, comment="Exit long")

Did this answer your question?