Lower timeframe stochastic on higher timeframe
02/11/2022 at 7:41 AM #188034
Is it at all possible to code an indicator that uses a 3 minute timeframe stochastic on a 15 min timeframe? So the indicator will be on the 15 minute but display whether the 3 min stochastic is up or down.
Maybe it is a dumb question, but if it is possible, what would that code look like. I am not too sharp on using time in the codes yet.
Thanks,02/11/2022 at 8:22 AM #18803603/14/2022 at 10:41 AM #189933
Then how will I make a 1H 50SMA display on a 15 minute chart? I also want to include the 1H 50SMA into a code that will be on the 15 min chart. What would this look like? I have seen some examples but not really sure how to get started. It needs to be an indicator and not a strategy or screener. If someone could please assist, it would be appreciated.
Thanks,03/14/2022 at 12:34 PM #189948
There you go (you can use it on any lower TF whose multiple is 1 hour, i.e. 60 minutes):1234Timeframe(1h,Default) //or Timeframe(1h,UpdateOnClose)Sma50 = average[50,0](close)Timeframe(default)RETURN Sma50 AS "1h sma50"
You can use the UPDATEONCLOSE version if you need to update the 1h Sma50 only when the 1h bar closes (it will apdate the plotted Sma50 once every 4 15-minute bars).03/15/2022 at 9:20 AM #189999
Great, thanks for the post! Is there any way to build something (as close as possible) like this in an indicator? So if I put the indicator on a 15 minute chart, it should display where the 50 SMA of the hour is. I hope this makes sense. I know you can’t use “timeframe” in indicator codes and also can’t just do 50 x 4 because 15min x 4 = 1H timeframe. is there a way to get it close even if not exact?03/15/2022 at 11:13 AM #190009
The above code IS an indicator and you CAN use the keyword TIMEFRAME since about a year now.
You don’t need to do any math any longer (despite incorrect, many used it). Just choose your TF, the plot the indicator on any lower TF (of which the greater TF is a multiple).
If you choose 1H TF, then you can plot that indicator on any lower TF, but not, say 7-minut TF, as 1H (60 minutes) is not a multiple of 7.
If you choose 1H TF and you want to plot it on a 1-second TF, bear in mind that 1 hour tallies 3600 seconds, so if you want to use an SMA 100, you would need 360000 (360K) bars, which are not available (max is 200K).03/24/2022 at 9:08 AM #190386