TradingView
tanayroy
Aug 19, 2021 6:59 AM

Binary Option Strategy Tester with Martingale 

Euro Fx/U.S. DollarFXCM

Description

In Binary options, strategy testing is a bit different. The script is just a try to test Binary options strategies.
Assumption:
  • 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.

The script is not counting your profit or loss, it just counting the winning and losing trades.

Input Options:
  • Choose long only or short only test. Default is both.
  • You can continue your trade with Martingale Level, up to 5. Default is 1 (no Martingale)
  • You can choose Martingale trade type
    SAME: if call subsequent trade will be call only and vice versa
    OPPOSITE: if call subsequent trade will be put
    FOLLOW CANDLE COLOR: Subsequent trade will follow previous candle color
    OPPOSITE CANDLE COLOR: Subsequent trade will opposite of previous candle color
  • You can choose trading session to test. Default is false.


The strategy is taken from Vdub Binary Options SniperVX v1 (by @vdubus). I have deleted extra parts and kept only the necessary part.
Without Martingale

Result Table

With Martingale


I am very new to Pine script, so waiting for your comments and review.

Release Notes

Comments
TradinGiri_Binary
Hallo sir,
How can I change 1 minutes expiry to 2 minutes expiry in 1 minute timeframe.
avinashpatil4798
I have 7 steps for martingale. How can add more 2 step in this pine ?
Appreciated your work.
SomethingAintRight
Can you explain what the number mean? I switch it to Call and I see 5 show up as if the trade is profitable once there is a green trade but it's much lower than the last 6 candles that printed? Is the script still counting that as a winning trade even though its not?
tanayroy
@SomethingAintRight, If you are using 1m chart, the script assume that you are taking options with 1m expiry. So, CE is counted as win when we have one green candle in martingale steps. The number is martingale step.
NicholasG101
I'm not seeing the buy and sell signals.
tanayroy
@NicholasG101, the buy and sell signals on the chart comes from Vdub Binary Options SniperVX v1 (by @vdubus). if you add the script you can see the signals on the chart. This script tests the strategy and presents the historical win and loss ratio. In script pane, you can find the signals as C for Call (color teal) and P for put (color maroon). You can also test your strategy by replacing the strategy part with your strategy. Just keep is_call and is_put variable.
williamlacerra
Very very nice content!!!!
I've some difficult to read and adjust for my case the script, I'm looking to make the script with dynamic how many martingale to use, or also add every time for my case but still not clear how to do it, for example add 1 (i.e total 6 martingale) could we looking into?
tanayroy
@williamlacerra, I am developing a newer version of this. Hope that will solve all the problem.
williamlacerra
@tanayroy, thank you for leave this content open!! I will look into
williamlacerra
@tanayroy, looking into your script, i'm also new on pinescript. I found the martingale way could be a constraint, i mean if i don't mind whats next trade type will be (put or call, short or long) how can i remove it?
More