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!
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
//@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)