TradingView
Jomy
2 Th01 2020 01:32

expected range STRATEGY 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Mô tả

This is the strategy version of "expected range STUDY". The buy and sell signals are generated with the study version, but what is displayed on the chart is different. Here, the PnL of each trade is shown on the chart, as well as the peak profit point of each trade up till the present. Black areas represent take profit and waiting for the next trade to start. Green = long. Red = short. Set to take profit at 53% and stoploss is set to -7%. Having a stoploss trigger does not put a black area on the chart. For the XBTUSD 2 hour chart, but use it however you like on whatever chart for backtesting.

Enjoy. Don't get rekt. A good backtest doesn't mean a good forward test. Use at your own risk.

Phát hành các Ghi chú

Just a small tweak to a small bug in the expected range STRATEGY. There was a bug in the strategy tester where the minimum number of contracts to trade was set to 1, and 1 contract was equal to the price of Bitcoin. The initial capital was set to 1000. So if the first long signal was bought at $15000, it would buy $15000 worth, which is 15x leverage essentially, and that isn't right. The leverage remained high like this until the capital earned exceeded the Bitcoin price in the backtest. I set it so the minimum amount to trade to .000001 contracts (or the Bitcoin price multiplied by .000001) which should fix the problem.

I also added a backtesting range, so you can test this strategy in isolated time ranges.

I apologize for releasing this strategy with the slightly misleading backtest results. I was unaware until someone pointed out the bug to me recently. Again, thank you to the diligent community here for pointing out the error. The results are still good, just a little less good, but still very good. I think on the 2h chart the profit factor has changed from somewhere just over 4 to 3.937.

-Jomy
Bình luận
Alpha_MXK
Hi Jomy, is this strategy suitable to test on equities and commodities, or does some of the initial conditions need to be changed for it to function ?
Regards,
Alpha
obstak
what does a gray background color indicate?
trickzter
Hi Jomy. Thank you for your great work! Very interesting approach with insane results. Could you maybe implement the possibility to change the period of time for calculation? Would be nice to be able to start in 2019 or even in 2020 to check the trades from the past. And something seems to be wrong: Could you please check the first trades at the 2h timeframe and compare it with the 1h timeframe? The profits of the first trade on the 1h timeframe seems a bit unrealistic (0x or 1x lev, 423.8 % profit). Thx!!
Jomy
@trickzter, done and done.
wwrekt
does it repaint?
Jomy
@wwrekt, nope. It does have a very optimized backtest though. It has a bunch of variables which were tweaked to show the optimal result at the time of posting.
wwrekt
@Jomy, best TF to use as per you is 2h then
i'll try and play with it, if it isn't repainting
Jomy
@wwrekt, for your information, I think all codes that repaint use the security function. They'll import data from other longer time frames. So if you ever see a line of code like "src = security(coin, "240", hlc3)" you can only use that code on time frames 240 minutes and longer, or else you will get repainting. If I'm testing other people's code, the first thing I'll do is hunt for the word "security" in the code. If it uses it, it doesn't mean code is necessarily bad, but it does make it suspicious.
wwrekt
@Jomy, ahhh
thanks bro, will keep that thing in mind from next time for sure
Thêm nữa