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 abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un 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)