aquajets1

Binary Options Tester w/ Vdubus money management

Added implementation of vdubus's money management strategy to binary options tester. As before, the entry/exit strategy is just there for an example, modify go_down and go_up for your strategy as the short and long entry points. Also as before, do not use present variables (i.e. close, close, ema_6_min in the example) in go_up and go_down, as this is akin to having future information. Calling past forms of compound present variables (ema(close,6)) is fine.
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?
//@version=2
study("Binary Options Tester w/ Vdubus money management", overlay=false)

ema_6_min = ema(close,6)
ema_14_min = ema(close,14)

go_down = crossunder(ema_6_min[1],ema_14_min[1])
go_up = crossover(ema_6_min[1],ema_14_min[1])

//win/lose testing. leave these lines for tester
val_win = go_down ? ((open[0] > close[0]) ? (val_win[1] + 1) : (val_win[1])) : (go_up ? ((open[0] < close[0]) ? (val_win[1] + 1) : (val_win[1])) : (nz(val_win[1]) + 0))
val_lose = go_down ? ((open[0] < close[0]) ? (val_lose[1] + 1) : (val_lose[1])) : (go_up ? ((open[0] > close[0]) ? (val_lose[1] + 1) : (val_lose[1])) : (nz(val_lose[1]) + 0))
//

fraction_return = input(.75, title='fraction_return')

return = (val_win * fraction_return)  - val_lose

//plot(return)
//plot(val_win,color=green)
//plot(val_lose,color=red)
//plot(sma_12_min, color=blue)
//plot(sma_60_min, color=orange)
//plot(val_win/(val_win + val_lose))

//Section for testing vdbus money management strat.
did_win = val_win[0] > val_win[1]
did_lose = val_lose[0] > val_lose[1]

top_out = input(3)

factor = did_win ? ((nz(factor[1]) + 1) % top_out) : (did_lose ? 0 : nz(factor[1]))

bet_factor = nz(factor[1])

bet = pow((1 + fraction_return),bet_factor)

winnings_on_bet = bet * (fraction_return)

strat_return = did_win ? (nz(strat_return[1]) + winnings_on_bet) : (did_lose ? (nz(strat_return[1]) - bet) : nz(strat_return[1]))

plot(strat_return)