Multiple timeframes EMA crossover

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #113686 quote
    Abz
    Participant
    Veteran

    Hello

    i was thinking of making the below code avaliable for multiple timeframes so i only need 1  screener window instead of 4.  TF 5 min, 15min , 1 hour , 4 hour. Want to display in the screener what timeframes the conditions are met. anyone have a suggestion?

     

    rs = RSI[7](close)
    ema50 = ExponentialAverage[50](close)
    ema200 = ExponentialAverage[200](close)
    
    // Conditions to enter Long positions
    b = rs[1] crosses over 30
    x1 = ema50[1] > ema200[1]
    
    
    // Conditions to enter Short positions
    d = rs[1] crosses under 70
    x2 = ema50[1] < ema200[1]
    
    
    Signal= 0
    IF b and x1 THEN
    Signal = 1
    ELSIF d and x2 THEN
    Signal = 2
    ENDIF
    
    SCREENER[Signal](Signal AS "1=↑, 2=↓")
    #113688 quote
    robertogozzi
    Moderator
    Master

    There you go:

    // 1 = ↑
    // 2 = ↓
    // 9 = no signal on that TF
    //
    // 4 = 4-hour TF
    // H = 1-hour TF
    // 1 = 15-minute TF
    // 5 = 5-minute TF
    //
    TIMEFRAME(4 hour)
    Xrs     = RSI[7](close)
    Xema50  = ExponentialAverage[50](close)
    Xema200 = ExponentialAverage[200](close)
    Xb      = Xrs[1] crosses over 30
    Xx1     = Xema50[1] > Xema200[1]
    Xd      = Xrs[1] crosses under 70
    Xx2     = Xema50[1] < Xema200[1]
    XSignal= 9000
    IF Xb and Xx1 THEN
       XSignal = 1000
    ELSIF Xd and Xx2 THEN
       XSignal = 2000
    ENDIF
    //
    TIMEFRAME(1 hour)
    Yrs     = RSI[7](close)
    Yema50  = ExponentialAverage[50](close)
    Yema200 = ExponentialAverage[200](close)
    Yb      = Yrs[1] crosses over 30
    YY1     = Yema50[1] > Yema200[1]
    Yd      = Yrs[1] crosses under 70
    YY2     = Yema50[1] < Yema200[1]
    YSignal= 900
    IF Yb and YY1 THEN
       YSignal = 100
    ELSIF Yd and YY2 THEN
       YSignal = 200
    ENDIF
    //
    TIMEFRAME(15 minute)
    Zrs     = RSI[7](close)
    Zema50  = ExponentialAverage[50](close)
    Zema200 = ExponentialAverage[200](close)
    Zb      = Zrs[1] crosses over 30
    ZZ1     = Zema50[1] > Zema200[1]
    Zd      = Zrs[1] crosses under 70
    ZZ2     = Zema50[1] < Zema200[1]
    ZSignal= 90
    IF Zb and ZZ1 THEN
       ZSignal = 10
    ELSIF Zd and ZZ2 THEN
       ZSignal = 20
    ENDIF
    //
    TIMEFRAME(5 minute)
    Wrs     = RSI[7](close)
    Wema50  = ExponentialAverage[50](close)
    Wema200 = ExponentialAverage[200](close)
    Wb      = Wrs[1] crosses over 30
    WW1     = Wema50[1] > Wema200[1]
    Wd      = Wrs[1] crosses under 70
    WW2     = Wema50[1] < Wema200[1]
    WSignal= 9
    IF Wb and WW1 THEN
       WSignal = 1
    ELSIF Wd and WW2 THEN
       WSignal = 2
    ENDIF
    //
    TIMEFRAME(default)
    Signal =  XSignal + YSignal + ZSignal + WSignal
    IF Signal = 9999 THEN
       Signal = 0
    ENDIF
    SCREENER[Signal](Signal AS "1=↑,2=↓/4H15")
    Abz thanked this post
    x-23.jpg x-23.jpg
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Multiple timeframes EMA crossover


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Abz @abbas_sadiq Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
6 years, 3 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 11/27/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...