Clean version of BitcoinFib30
Works as is; with 6 % stop loss due to the addition of SAR as a condition 🙂
PS: Williams R% lenght 12 but backtest shows 13 is slightly better. Main time frame of 6 HOURS highly encouraged. This strategy has beat BTC gains for over 8 weeks and still going. Not good for alt-coin sets! Only for BTC!
- This topic was modified 7 months, 4 weeks ago by ratimbum.
- This topic was modified 7 months, 4 weeks ago by ratimbum.
Related Scripts From This Author
April 7, 2022 at 3:28 AM #2960
April 7, 2022 at 4:33 PM #2961
April 8, 2022 at 3:46 AM #2966::
From a technical stand point this script is fine to use with leverage.
However, risk management is an ill studied subject. At the moment bitcoin is doing 5-10% intraday movements alts doing 10-50% intraday. If you lev 100x and your stop loss is of 1% you will get liquidated sooner than 1% bellow because of the minimum margin retention:
10x lev =
1% stop loss -> 10% loss of capital
5% stop loss -> 50% loss of capital
10% stop loss -> 100% loss of capital
This is not a market that is apt for leverage when intraday swings are this extreme. Personally, I think you want to stick to 1x right now and not give in to the temptation of leverage.
What concerns this specific script; you can see on the chart that the stop loss is 1-2% however, the conditions used in the script are “continuous”.
This means that if stop loss gets hit, it will immediately re-enter after it got hit and set another stop loss at 1-2% so you should really plan around the bottoms coming after the stop loss getting hit a couple of times. (Think 5 times or so. If it gets hit 5x at 1% and you are using leverage 2x that is still a 10% loss of capital! (You can win 1000000000000000% in profit but it just takes a 95% loss to get you liquidated!)
The way I mediated this is to use long time frame from 30 min+ (Sweet spot is 6 hours) since Haas will always wait for the next period even when using continuous indicators.
Personally; would not use leverage beyond 2x the returns on this script are insanely good without the risk of leverage; no need to get greedy when the market is this volatile.
Stay safe 🙂
April 8, 2022 at 3:49 AM #2967
April 8, 2022 at 3:57 AM #2968::
Last but not least. Keep in mind that when you short in futures your risk extreme goes from 0/infinity (1x long) to 100%(1x short) . You really don’t want to be shorting on leverage when the market is this volatile. (Funding fees can also eat up your equity and reduce that extreme dynamically)
June 3, 2022 at 7:05 PM #3077KobaltBasic::
You could limit long entries on Inverse to only very OS delayed MFI/RSI and a high ATR this is pretty good at catching the lows (1 minute interval for ATR others rsi etc try higher intervals)
If you are still interested in this let me know if you already have the unique positionId thing :
(connecting PositionContainer orderId to the StopLoss or an Insurance like done here will not assign a NewGuid in Managed Trading Bot here ) I can look or cook up a template for this.
—- assorted bits Regarding leverage:
When you start with 1x on futures you immediately lock your equity and cannot apply higher leverage so it in a way seems safe but it’s just as unforgiving as spot alts can be
If you start with max leverage you can easily deleverage to get more range for your bucks.
Inverse Perpetual (with BTC or COIN as collateral) Long positions are inherently much riskier as when market goes against your Long position, your uLoss gets bigger while the price of BTC also goes down your margin requirements are impacted even more this will get you liquidated for sure.
Right now is still.. bear market, even if you think we have seen a bottom having a short of 1x leverage will be neutral and protect your USD value (and shorts are very forgiving as when market goes against you BTC collateral USD value goes up (You may end with less BTC same USD value while every successfully closed Short increases your BTC.. (I only open longs as a hedge but pretty much never on Inverse)
(Even in Bull market I only traded short on inverse, just more conservatively… building up to 1x around the local and ATH’s never opened long on Inverse ever.. learned my lesson)
if I’m bullish will buy BTC on Spot (or open a Long on BTC/USDT against my 1x short on inverse) I only ever start to open long on USDT Linear for any market but will also short there against spot or HEDGE, my USDT scripts tend to trade both directions (MMB variations)
Just use very small amounts, check what equals 1x leverage amount then set to max leverage and only use part a very small part 1% up to 1.5% start slow and set your orders bigger further from price ~1.25x then after you return and it looks like -300% you can recover with some DCA you can very easily get that position back in range, ‘Freeze it for manual fixing after you do your things’ with a hedge, Or just wait it out..maybe with a mix of all of the above..
Patience works well for BTC just check daily, 4h 1h timeframes as long as price keeps rejecting 200MA it is bear market, expect price to revisit 200MA on daily when that gets broken, open a long hedge, start getting out of the short.
using leverage on an as needed basis can really help to still safely get you back in the trade range to exit with a profit, but the hardest thing for me has been to NOT close my short position…
[really difficult right now every low looks very low while it keeps going lower on macro any up move can turn relief rally up to 40% and still be a local rally to reject 200MA]
I always try to build in local uptrend up to 4hour charts or have >1x leverage short in a still bear market on inverse it’s a neutral hedge and earns you funding interest in BTC
using Market orders also adds a big hurdle as you pay difference between Mark and Bid + taker fees, to add to your position use post only MakerOrCancel really helps ‘relatively’ confident it will go both higher and lower than current market so patience is key .
[this was collected and copy pasted on topic]
April 25, 2022 at 2:23 AM #2991
April 25, 2022 at 3:54 AM #2992
April 29, 2022 at 4:40 AM #2996
April 29, 2022 at 3:09 PM #2997::
ok BTCfib30 is having mixed luck with being consistent in using its Stop Loss and Take profit orders… So its missing them at times… BTC/USD inverse perp was working ok at first took both a short position and exited with profit effectively then execeuted a long order and took up position correctly but then failed to Stop loss and went far beyond its percentage setting. Funny thing in the log when it executed the short it returned a single balance error checking the contract size trying to complete the order and take position then somehow corrected and that 1st order was completed without fuss and it went back to work but failed to act on SL as described above. When I get that contract balance error any other times it repeats unable to read the correct order balance and that order vanishes from the servers orders and positions tab but is still visible on exchange… the bot can’t return to work while it can’t read the contracts balance correctly and order can’t be cancelled from positions tab because it not visible so it has to be cancelled manually on exchange, now bot is unable to show statistics because the only way to get it to work again is clean the bot and stop it trying to remove an order that isn’t there any longer, turn it off and restart it. This has happened on a few different pairs a couple of times… With ether it wouldn’t take profits and kept enlarging the TP trigger much higher than settings dictated it should and I had to manually do it from exchange… but then the order was out of postion for the bot and unable to reconcile itself so again turned of cleaned and restarted, only difference with ETH was order was still visible in positions tab until removed on exchange and not given a balance error. I’m getting a lot of disconnects from the websocket with this error repeating every couple hours with the bots active
29-04-2022 14:38:58 |ERROR| WebSocketSharp.WebSocketException: The header of a frame cannot be read from the stream.
at WebSocketSharp.WebSocketFrame.processHeader(Byte header)
at WebSocketSharp.WebSocketFrame.<>c__DisplayClassa.<readHeaderAsync>b__9(Byte bytes)
at WebSocketSharp.Ext.<>c__DisplayClass9.<ReadBytesAsync>b__8(IAsyncResult ar)
29-04-2022 14:38:58 |ERROR| Connection to production.hcdn.ws.haasapi.com:80 has failed, retrying in 5 sec…
June 3, 2022 at 6:07 PM #3075KobaltBasic::
This happens due to not assigning a fresh unique positionId (connecting PositionContainer orderId to the StopLoss or an Insurance like done here will not assign a NewGuid in Managed Trading Bot here )
Try adding this custom command to manually adjust/fix position issues
July 19, 2022 at 5:38 PM #3167