OPEN-SOURCE SCRIPT

Trade Hour

已更新
This script is just finds the best hour to buy and sell hour in a day by checking chart movements in past
For example if the red line is on the 0.63 on BTC/USDT chart it mean the start of 12AM hour on a day is the best hour to buy (all based on
It's just for 1 hour time-frame but you can test it on other charts.
IMPORTANT: You can change time Zone in strategy settings.to get the real hours as your location timezone
IMPORTANT: Its for now just for BTC/USDT but you can optimize and test for other charts...
IMPORTANT: A green and red background color calculated for show the user the best places of buy and sell (green : positive signal, red: negative signals)

settings :
timezone : We choice a time frame for our indicator as our geo location
source : A source to calculate rate of change for it
Time Period : Time period of ROC indicator


About Calculations:

1- We first get a plot that just showing the present hour as a zigzag plot
2- So we use an indicator ( Rate of change ) to calculate chart movements as positive and negative numbers. I tested ROC is the best indicator but you can test close-open or real indicator or etc as indicator.
3 - for observe effects of all previous data we should indicator_cum that just a full sum of indicator values.
4- now we need to split this effects to hours and find out which hour is the best place to buy and which is the best for sell. Ok we should just calculate multiple of hour*indicator and get complete sum of it so:
5- we will divide this number to indicator_cum : (indicator_mul_hour_cum) / indicator_cum
6- Now we have the best hour to buy! and for best sell we should just reverse the ROC indicator and recalculate the best hour for it!
7- A green and red background color calculated for show the user the best places of buy and sell that dynamically changing with observing green and red plots(green : positive signal, red: negative signals) when green plot on 15 so each day on hour 15 the background of strategy indicator will change to 15 and if its go upper after some days and reached to 16 the background green color will move to 16 dynamically.

發布通知
Easy way to use:
You can just wait for a green vertical background color to buy and a red bg color to sell :)

How to use it:
You see two lines (red and green) that them show you the best time to trade ( green for buy, red for sell )in UTC+0000 timezone! You should convert last values of this two line to your timezone for example:
If green line in 3.5 and I'm in Tehran city or Iran Country with this time zone(+4:30) I will add 4.5 hour on it : 3.5+4.5=8
This number means I will buy in 8:00 AM
IMPORTANT: 8:00 AM is Not exactly the best hour to buy! it's just mean that: must of positive changes average hour in past days happend on 8 on rsi and mfi indicators.

More Info:
This strategy based on idea of circular mean with atan2
Circular average calculation for 24 hour daily periods
This calculation is just for fixing normal average problem on 24 hour day periods for understanding what we want to do think to that: If we have two hours we want to average them to 24 but if we calculate it with normal mean the result will be wrong: (2+22)/2=12 we know that the periodic things will not average like that and we should use another method to calculate mean of this like numbers. In this article we use python coding to fix this problem and generate the realistic average of hours
We used normal mean(arithmetic mean) formula on Trade Hour V3 I don't update V3 to V4 cuz V3 still better than V4 but V4 works without negative and unknown results and have more standard formula than V3.

for more information see this links:
en.wikipedia.org/wiki/Atan2
en.wikipedia.org/wiki/Circular_m...
gist.github.com/mablue/4c27f920b...
Bitcoin (Cryptocurrency)BTCUSDCandlestick AnalysisCryptocurrencydaytradinghourlyRate of Change (ROC)statistics

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明