Multi timeframe conditional testing question

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18969 quote
    ck1066ck1066
    Participant
    Average

    Hi,

    I ‘m trying to code a ProScreener indicator using two timeframes, 15 minutes and 5 minutes. How do I test a condition on the 15 minutes timeframe has been met within the last, say 10 bars, while on the 5 minute time frame?

    See the example code below where the “long” condition is what I’m trying to figure out

    //long
    TIMEFRAME(15 minutes)
    ma1=ExponentialAverage[200](close)
    stochk=Stochastic[8,3](close)
    a1=close>ma1
    a2=(stochk crosses over 20) or (stochk crosses over 50 and mo>0)
    l1=a1 and a2
    
    TIMEFRAME(5 minutes)
    ma2=ExponentialAverage[200](close)
    mo=Momentum[12]
    stochk1=Stochastic[8,3](close)
    b1=close>ma2
    b2=(stochk1 crosses over 20) or (stochk1 crosses over 50 and mo>0)
    l2= b1 and b2
    long=l2 and <l1=1 in the last 10 bars of the 15 minute timeframe>
    #18971 quote
    ck1066ck1066
    Participant
    Average

    “long” as in line 16 of the above code.

    #18990 quote
    NicolasNicolas
    Keymaster
    Legend

    So if I understand correctly your request, you want to return immediately the stocks that fulfilled the conditions of your 5 minutes timeframe, while the conditions of the 15 minutes timeframe were met at least 1 time within the last 10 bars?

    #19045 quote
    ck1066ck1066
    Participant
    Average

    Yes that’s correct.

    #19050 quote
    NicolasNicolas
    Keymaster
    Legend

    Ok, so please find below the modified code accordingly to this condition testing on the 15 minutes timeframe:

    //long
    TIMEFRAME(15 minutes)
    ma1=ExponentialAverage[200](close)
    stochk=Stochastic[8,3](close)
    a1=close>ma1
    a2=(stochk crosses over 20) or (stochk crosses over 50 and mo>0)
    l1=summation[10](a1 and a2)>0
    
    TIMEFRAME(5 minutes)
    ma2=ExponentialAverage[200](close)
    mo=Momentum[12]
    stochk1=Stochastic[8,3](close)
    b1=close>ma2
    b2=(stochk1 crosses over 20) or (stochk1 crosses over 50 and mo>0)
    l2= b1 and b2
    
    screener [l1 and l2]

    It now should operate correctly, please let us know!

    #19086 quote
    ck1066ck1066
    Participant
    Average

    Thanks Nicolas, much appreciated as always.

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Multi timeframe conditional testing question


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
ck1066 @ck1066 Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by ck1066ck1066
9 years, 9 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 12/22/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...