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.
オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?
//@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)