aquajets1

Binary Options Strategy Testing Script

This is a script for testing binary options trading strategies. To test a strategy, modify the 'go_down' or 'go_up' booleans. These SHOULD NOT access any current values (for example, 'ohlc4' or 'close'), or the backtesting will not be an accurate representation of the forward values.

Modify the fraction_return input to be the return rate of the option on success. This is assumed to be a true 100 or 0 option- i.e. if the choice is not correct, there is a 100% loss.

The strategy in place is merely an example, and as you can see, has a very negative rate of return when implemented as a strategy.

Please comment in your code if you use this in any future posts. Thanks!
オープンソーススクリプト

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

免責事項

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

チャートでこのスクリプトを利用したいですか?
//@version=2
study("Binary Options Tester", overlay=false)

sma_12_min = sma(hl2,12)
sma_60_min = sma(hl2,60)

go_down = (open[1] > close[1]) and (open[2] > close[2]) and (sma_12_min[1] < sma_60_min[1])
go_up = (open[1] < close[1]) and (open[2] < close[2]) and (sma_12_min[1] > sma_60_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]) : (val_lose[1] + 1)) : (go_up ? ((open[0] < close[0]) ? (val_lose[1]) : (val_lose[1] + 1)) : (nz(val_lose[1]) + 0))
//

fraction_return = input(.88, 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)