TradingView
esturilio
10 de Jan de 2020 20:44

Deadband cross detection for BTC (XBT) 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Descrição

Description: meant to be used with BTCUSD (or XBTUSD) on 3 mins to 1h candles charts.
Idea is to provide a tool to detect break-out's from a dead band around an EMA, and to detect back-in's to the dead band.
Detection is fundamentally based on how much %, at least, a certain candle body has ruptured the dead band (adjustable).
Long and short flags are placed on the chart, as well as the deadband. Can be used to generate alers.
With minimal modifications, can be convert to a Strategy script.

Following are ideas to play around if you want. Room for improvements:
- convert constants into inputs, and diversify thresholds assimetrically
- play around with wether or not using pyramiding (here pyramiding is blocked)
- look at several bars in a sequence, not only current
Comentários
cahtreber
tnx, man, can you share how do you use this? I see good usage on larger timeframes. Whats your take on that?
esturilio
@cahtreber, I've shared this as a didactic tool to show some practical use of functions, labels and the concept of defining a dead-band while avoiding pyramiding within a study. Avoiding pyramiding is not standard Study functionality and may pose difficulties in for beginners in their early-days of programming.

I'm a Process Control Engineer in my profession and I try to mix some of the control theory within trading charts as a hobby, as I trade also for a hobby. I'm happy to hear you've found nice real use for that.
I suggest the following:
- convert it into a strategy to back-test it
- if you still confirm the potential, you can use this script to generate real alerts

Reach out if you want to discuss anything.

PS: I'm planning to publish a more featured version with stoploss and takeprofit ;)
cahtreber
@esturilio, This is very nice overtrading prevention in forming strategy and having optimal entry-exit positions.
I am not into coding but I am starting to think that is wise to learn so I can tweak my trading ideas. Your thinking is diverse and would glad to see your next work

Glad to hear back, and thank you for sharing
saeed_mega_trader
tnx
Mais