rthomson

BitMex Trailing Stop Strategy

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.
Remove from Favorite Scripts Add to Favorite Scripts
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?
+1 Reply
rthomson ippp0031
@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.
Reply
ippp0031 rthomson
@rthomson, Okay, what would I need to change to base it off another timeframe? I trade mainly on 1 to 9 hours.
Reply
ippp0031 rthomson
@rthomson, Is it tickerID? I just change the number in that?
Reply
rthomson ippp0031
@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.
+2 Reply
ippp0031 rthomson
@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.
Reply
rthomson ippp0031
@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.
Reply
ippp0031 rthomson
@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?
Reply
rthomson ippp0031
@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.
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar Shows How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Help Center Refer a friend Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out