xmd79

Financial Astrology Indexes ML Daily Trend

Jul 2nd, 2022
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.11 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © citlacom
  3. // @version=4
  4. // Strategy developed by the Financial Astrology Research Group.
  5.  
  6. study(title="Financial Astrology Indexes ML Daily Trend", shorttitle="AstroIndexesMLDailyTrend")
  7.  
  8. var int futureWeeksNumber = input(1, type=input.integer, minval=0, step=1, title="Future weeks prediction to display in the plot")
  9.  
  10. // Due to TradingView limitations to integrate external signals from financial astrology ML models
  11. // we needed to hardcode the buy/sell signals here in the code as PineScript array with start Date index at 2021-01-01
  12. // and end index at 2022-12-31, this signal is based on the correlation of planets cycles and price trend for each research
  13. // asset historical data detected through machine learning methods, once models are trained can forecast future daily trend.
  14. varip int[] DJI = array.from(
  15. 0,0,1,1,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,1,1,0,1,1,1,0,1,1,0,1,0,1,1,1,1,0,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,
  16. 1,1,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,1,0,0,1,1,1,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,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,0,1,0,1,0,1,1,0,0,1,0,0,0,0,0,1,1,0,1,1,1,0,0,0,1,1,0,1,1,1,0,1,1,0,1,0,0,0,1,1,1,0,1,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,1,1,1,0,0,0,1,0,1,1,0,1,1,0,
  58. 1,0,1,1,1,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,1,0,1,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,0,0,1,1,0,0,1,0,1,0,0,1,1,1,1,0,0,0,0,1,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,0,1,1,1,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,0,1,1,0,1,1,1,0,1,0,1,1,0,1,1,0)
  59.  
  60. varip mlSignal = if (syminfo.ticker == "DJI")
  61. DJI
  62. else if (syminfo.ticker == "UK100")
  63. FTSE
  64. else if (syminfo.ticker == "SPX")
  65. GSPC
  66. else if (syminfo.ticker == "GLD")
  67. GLD
  68. else if (syminfo.ticker == "IBC")
  69. IBEX
  70. else if (syminfo.ticker == "IXIC")
  71. IXIC
  72. else if (syminfo.ticker == "NI225")
  73. N225
  74. else if (syminfo.ticker == "BANKNIFTY")
  75. NSEBANK
  76. else if (syminfo.ticker == "NIFTY")
  77. NSEI
  78. else
  79. array.from(0)
  80.  
  81. calculateWeekBarsCount(numWeeks) =>
  82. // Daily resolution
  83. if (timeframe.period == "D")
  84. numWeeks * 5
  85. // Hourly resolution
  86. else if (timeframe.period == "60")
  87. numWeeks * 5 * 7
  88. // 2 hours
  89. else if (timeframe.period == "120")
  90. numWeeks * 5 * 4
  91. // 3 hours
  92. else if (timeframe.period == "180")
  93. numWeeks * 5 * 3
  94. // 4 hours
  95. else if (timeframe.period == "240")
  96. numWeeks * 5 * 2
  97. // For other resolutions don't plot future predictions.
  98. else
  99. 0
  100.  
  101. calculateCandleTimeDiff() =>
  102. // 2021-01-01 00:00 ML signal day time serie start.
  103. futureOffsetSeconds = calculateWeekBarsCount(futureWeeksNumber) > 0 ? futureWeeksNumber * 7 * 86400 : 0
  104. referenceUnixTime = 1609459200 - futureOffsetSeconds
  105. candleUnixTime = (time / 1000) + 1
  106. timeDiff = candleUnixTime - referenceUnixTime
  107. iff(timeDiff < 0, na, timeDiff)
  108.  
  109. getMLSignalCandleIndex() =>
  110. timeDiff = calculateCandleTimeDiff()
  111. // Day index, days count elapsed from reference date.
  112. candleIndex = floor(timeDiff / 86400)
  113. iff(candleIndex < 0, na, candleIndex)
  114.  
  115. getMLSignal() =>
  116. // Map array data items indexes to candles.
  117. int candleIndex = getMLSignalCandleIndex()
  118. int itemsCount = array.size(mlSignal)
  119. // Return na for candles where indicator data is not available.
  120. int index = candleIndex > itemsCount ? na : candleIndex
  121. signal = if (index >= 0 and itemsCount > 1)
  122. array.get(mlSignal, index)
  123. else
  124. na
  125.  
  126. calculateSmoothSignal(mlSignalSerie) =>
  127. int smoothPeriod = calculateWeekBarsCount(1)
  128. if (smoothPeriod > 0)
  129. sma(mlSignalSerie, smoothPeriod)
  130. else
  131. na
  132.  
  133. // Compose signal time serie from array data.
  134. int mlSignalSerie = getMLSignal()
  135. // Calculate plot offset estimating market week open days
  136. int plotOffset = calculateWeekBarsCount(futureWeeksNumber)
  137. // Plot astrology ML daily trend prediction.
  138. float mlSignalSerieSmooth = calculateSmoothSignal(mlSignalSerie)
  139. plot(iff(mlSignalSerie == 1, 1, na), color=color.green, style=plot.style_cross, linewidth=2, offset=plotOffset)
  140. plot(iff(mlSignalSerie == 0, 0, na), color=color.red, style=plot.style_cross, linewidth=2, offset=plotOffset)
  141. plot(mlSignalSerieSmooth, color=color.yellow, style=plot.style_line, linewidth=2, offset=plotOffset)
  142.  
  143. // Highlight today prediction.
  144. todayStart = timestamp(syminfo.timezone, year(timenow), month(timenow), dayofmonth(timenow), 00, 00, 00)
  145. bgcolor((time >= todayStart) ? color.new(color.silver, 50) : na)
Advertisement
Add Comment
Please, Sign In to add comment