Lower timeframe stochastic on higher timeframe

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #188034 quote
    Stocks008
    Participant
    Average

    Hi,

    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,

    #188036 quote
    robertogozzi
    Moderator
    Master

    It’s only possible the other way round, that is plotting a 15-minute stochastic on a 3-minute TF.

    Stocks008 thanked this post
    #189933 quote
    Stocks008
    Participant
    Average

    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,

    #189948 quote
    robertogozzi
    Moderator
    Master

    There you go (you can use it on any lower TF whose multiple is 1 hour, i.e. 60 minutes):

    Timeframe(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).

    #189999 quote
    Stocks008
    Participant
    Average

    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?

    #190009 quote
    robertogozzi
    Moderator
    Master

    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).

    Stocks008 thanked this post
    #190386 quote
    Stocks008
    Participant
    Average

    It works great, thank you very much.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Lower timeframe stochastic on higher timeframe


ProBuilder support

New Reply
Author
author-avatar
Stocks008 @jd008 Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Stocks008
3 years, 10 months ago.

Topic Details
Forum: ProBuilder support
Language: English
Started: 02/11/2022
Status: Active
Attachments: No files
Logo Logo
Loading...