I have a strategy script that uses higher timeframes with the current timeframe on the chart. After some backtesting & research, I’ve discovered a mathetimatical pattern with which upper timeframes work with the current timeframes on the chart.
This is my discovery:
Example- lets say I put the chart on a 1hr timeframe. I’ve noticed that if I multiply 60(1hr for current chart) by 120 (60*120) the answer is 7200(minutes) which also equates to 5D. I then use that timeframe (5D) as my primary timeframe.
for the second timeframe to use, using the same chart (1hr timeframe). I’ve noticed that if I multiply 60(1hr for current chart) by 20 (60*20) the answer is 1200(minutes) which also equates to 20H. I then use that timeframe (20H) as my secondary timeframe.
Using 120 & 20 to multiply the current chart in minutes with those numbers have made me found that the backtested settings are always profitable.
So here is my question:
Is there a way to add that equation within pinescript? I would like my strategy script to automatically calculate which timeframes to use using that equation and also analyzing which current timeframe the chart is on. An example would be nice and I can figure out the rest. Thank you!
(multiplied in minutes)
Screenshot of timeframe settings