TradingView
rthomson
3 ago 2018 05:00

BitMex Trailing Stop Strategy 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Descrizione

This script is designed for those who want to use BitMex's trailing stop. It's not meant to be used as entry exits, but rather to get an idea of how wide the trailing stop needs to be. I suggest you backtest with different values. The script can also be integrated into an existing strategy which does give entry/exits to act as its stop loss.
Commenti
ippp0031
Can you explain how to put this to backtest further back in time- when I load it, it only shows trailing for the last 2 weeks?
rthomson
@ippp0031, unfortunately the way it is coded is based on the 1 minute chart which seems to have a limit on TV about how far back it will pull that in, so its limited in this regard.
ippp0031
@rthomson, Okay, what would I need to change to base it off another timeframe? I trade mainly on 1 to 9 hours.
ippp0031
@rthomson, Is it tickerID? I just change the number in that?
rthomson
@ippp0031, the problem is that an actual BItMex trailing stop isn't based on a close of a higher candle but on the live price reaching that value. Suppose a 1hr candle gives a low of 6200 but closed at 6300, a trailing stop at 6250 would be stopped out. But an indicator based on 4hr candle close wouldn't register that as stopped out, therefore not reflecting an actual BitMex trailing stop.
ippp0031
@rthomson, Okay. I see what you're saying, but need to process that in my head. I've modified it and playing around with it. I'm also thinking of using the modified version as manual entry or using Autoview to enter/exit, and I can also set the ts myself. I've changed tickerID to 60 and it does go further back in time. As a compromise, I may test setting it to say 5, 10 etc. As it happens it makes good calls in general for entry/exit when set to 60 and trailing set to 120ish for long and short I've noticed.
rthomson
@ippp0031, it wasn't really designed as an entry exit strategy, but to help refine one's trailing stop only. Since then I found ATR Trailing Stop better and manually adjusting it.
ippp0031
@rthomson, The results look pretty decent actually, am gonna test it and let you know how it goes. I published an edit of a supertrend ATR script myself, its on my page. What's the ATR Trailing Stop you're using, did you publish it or is it by someone else?
rthomson
@ippp0031, I published it, it is a pair with my Position Size Calculator based on it. I am currently working on a new version too. You will find them on my page as the most recent scripts I think.
Altro