tanayroy

Binary Option Ultimate Backtester-V.1[tanayroy]

The Binary Option strategy backtester gives the user extensive power to test any kind of strategy with advance trade management rules.
The strategy tester accepts external scripts as strategy sources. You can add your strategy and test it for historical stats.
Few assumption regarding strategy tester:
  • We are opening position at next candle after signal come
  • We are taking the position at opening price
  • Our call will be profitable if we get a green candle and put will be profitable if we get a red candle
  • We can open only one trade at a time. So if we are in trade, subsequent signals will be ignored.
How to make your strategy code compatible for strategy backtesting?
In your strategy code file add following lines:
Signal = is_call ? 1 : is_put ? -1 : 0
plot(Signal, title="🔌Connector🔌", display = display.none)
Is_call and is_put is your buy and sell signal. Plot the signal without displaying it in the chart. The new TradingView feature display = display.none, will not display the plot.

All Input options
Group: STRATEGY
Add Your Binary Strategy: External strategy to back test.
Trade Call/Put: Select CALL, to trade Call, PUT, to trade Put. Default is BOTH, Trading Call and Put both.
Number of Candles to Hold: How many candles to hold per trade. Default 1. If you want to hold the option for 30 minutes and you are testing your strategy in 15m intervals, use 2 candle holding periods.

GROUP: MARTINGALE
Martingale Level: Select up to 15 Martingale. Select 1 for no Martingale.
Use Martingale At Strategy Level: Instead of using Martingale per trade basis, using Martingale per signal basis. Like if we make a loss in the first signal, instead of starting martingale immediately we’ll wait for the next signal to put the martingale amount. For example if you start with $1 and you lose, at the next signal you will invest $2 to recover your losses.
Strategy Martingale Level: Select up to 15 Martingale at strategy signal level. Only workable if Use Martingale At Strategy Level is selected.
Type of Trade: Martingale trade type. Only workable if we are using Martingale Level more than 1.
It can be:
“SAME”:If you are trading CALL and incur a loss, you are taking CALL in subsequent Martingale levels.
“OPSITE”: if you are trading CALL and incur a loss, you are taking PUT in subsequent Martingale levels.
“FOLLOW CANDLE COLOR”: You are following candle color in Martingale levels, i.e if the loss candle is RED, you are taking PUT in subsequent candles.
“OPPOSITE CANDLE COLOR”: You are taking opposite candle color trade, i.e if the loss candle is RED, you are taking CALL in subsequent candle.

GROUP: TRADE MANAGEMENT
Initial Investment Per Option: Initial investment amount per trade
Payout: Per trade payout in percentage
Use Specific Session: Select to test trade on specific session.
Trading Session: Select trading session. Only workable if Use Specific Session is selected.
Use Date Range: Select to use test trades between dates.
Start Time: Select Start Time. Only workable if Use Date Range is selected.
End Time: Select end Time. Only workable if Use Date Range is selected.
Early Quit: Select to quit trade for the day after consecutive win or loss
Quit Trading after Consecutive Win: Number of consecutive wins. Only workable if early Early Quit is selected.
Quit Trading after Consecutive Loss: Number of consecutive losses. Only workable if early Early Quit is selected.
Buy/Sell Flip: Use buy signal for sell and sell signal for buy.

GROUP:STATS
Show Recent Stats: Show win trades in last 3,5,10,15,25 and 30 trades.
Show Daily Stats: Day wise win trades and total trades.
Show Monthly Stats: Month wise win trades and total trades.

Result and stat output:

Back tester without any strategy.
Strategy added with default option.
Stats with 7 Martingales. You can test up to 15.
Optional Stats:
Example Strategy code used :
//@version=5
indicator("Binary Option Strategy",overlay = true)
length = input.int(7, minval=1)
src = input(close, title="Source")
mult = input.float(3.0, minval=0.001, maxval=50, title="StdDev")
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev

fab_candle_upcross=(high< upper and low>basis) 

fab_candle_downcross= (high< basis and low>lower)

up_cross=ta.barssince(ta.crossover(close,basis))
down_cross=ta.barssince(ta.crossunder(close,basis))
is_first_up=false
is_first_down=false
if fab_candle_upcross
    for a=1 to up_cross 
        if fab_candle_upcross[a]
            is_first_up:=false
            break
        else
            is_first_up:=true

if fab_candle_downcross
    for a=1 to down_cross 
        if fab_candle_downcross[a]
            is_first_down:=false
            break
        else
            is_first_down:=true

        

//strategy for buying call
is_call=(is_first_up or is_first_down ) and close>open

//strategy for selling call
is_put=(is_first_up or is_first_down ) and close<open

Signal = is_call ? 1 : is_put ? -1 : 0
plot(Signal, title="🔌Connector🔌", display = display.none)


Tập lệnh chỉ hiển thị cho người được mời

Quyền truy cập vào tập lệnh này bị hạn chế đối với người dùng được tác giả ủy quyền và thường yêu cầu thanh toán. Bạn có thể thêm nó vào mục yêu thích của mình, nhưng bạn sẽ chỉ có thể sử dụng nó sau khi yêu cầu sự cho phép từ tác giả. Liên hệ tanayroy để thêm thông tin, hoặc làm theo hướng dẫn của tác giả bên dưới.

TradingView không đề xuất trả tiền cho một tập lệnh và sử dụng cho đến khi bạn hoàn toàn tin tưởng tác giả và hiểu cách thức hoạt động của tập lệnh. Trong nhiều trường hợp, bạn có thể tìm thấy một giải pháp thay thế nguồn mở miễn phí trong Thư viện Công cộng của chúng tôi.

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.

Hướng dẫn của tác giả

If you want access then please send me message with your request. Thank you!

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Cảnh báo: vui lòng đọc trước khi yêu cầu quyền truy cập.