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.
Remove from Favorite Scripts Add to Favorite Scripts
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(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]))

What's indicated by by the indicator ?
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out