Strategy Tester Tradingview

So basically this is my strategy (testing it for binary options)

// Version 0 – Created by UCS_Gears

// Version 1 – Modified by Chris Moody "Added B/S"

// Version 2 – Modified by UCS_Gears, "Replaced B/S with arrows", "Ability to change Overbought / Oversold Levels"

strategy(title="DMI Stochastic Extreme", shorttitle="DMI-Stochastic", overlay=false)

// Wells Wilders MA

wwma(l,p) =>

wwma = (nz(wwma[1]) * (l – 1) + p) / l

// Inputs

DMIlength = input(10, title = "DMI Length")

Stolength = input(3, title = "Stochastic Length")

Oversold = input(10, title = "Oversold")

Overbought = input(90, title="Overbought")

// DMI Osc Calc

hiDiff = high – high[1]

loDiff = low[1] – low

plusDM = (hiDiff > loDiff) and (hiDiff > 0) ? hiDiff : 0

minusDM = (loDiff > hiDiff) and (loDiff > 0) ? loDiff : 0

ATR = wwma(DMIlength, tr)

PlusDI = 100 * wwma(DMIlength,plusDM) / ATR

MinusDI = 100 * wwma(DMIlength,minusDM) / ATR

osc = PlusDI – MinusDI

// DMI Stochastic Calc

hi = highest(osc, Stolength)

lo = lowest(osc, Stolength)

Stoch = sum((osc-lo),Stolength) / sum((hi-lo),Stolength) *100

plot(Stoch, color = gray, title = 'Stochastic', linewidth = 2, style = line)

crossUp = Stoch[1] < Oversold and Stoch > Oversold ? 1 : 0

crossDown = Stoch[1] > Overbought and Stoch < Overbought ? 1 : 0

plot (Overbought, color = red, linewidth = 1, title = 'Over Bought')

plot (Oversold, color = green, linewidth = 1, title = 'Over Sold')

plotchar(crossUp, title="Crossing Up", char='↑', location=location.bottom, color=aqua, transp=0, offset=0)

plotchar(crossDown, title="Crossing Down",char='↓', offset=0, location=location.top, color=aqua, transp=0)

strategy.entry("Call", strategy.long, when = crossUp == true)

strategy.entry("Put", strategy.short, when = crossDown == true )

strategy.close("Put", when = barstate.isnew)

strategy.close("Call", when = barstate.isnew)

its supposed to go in at a crossdown hold for 1 candle and then close the trade and vice versa but the thing is if for example I get a 40% winrate with it I should get a 60% winrate if I just reverse the settings but instead I get a 45% winrate

Submitted November 01, 2020 at 06:05PM by PresentationOk5418
via https://ift.tt/2TNyNmk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s