Advice on combining conditions

Viewing 3 posts - 46 through 48 (of 48 total)
  • Author
    Posts
  • #54493 quote
    thetragiccirclethetragiccircle
    Participant
    Junior

    Sorry for late reply…family bereavement……..all the signals are long, there are no short signals….when I remove the variable, I get both short and long.

    #54686 quote
    NicolasNicolas
    Keymaster
    Legend

    Pleas try with this modified code, you should now be able to get LONG or SHORT results: 

    //criteria = 0
    // SHORT
    TIMEFRAME(15 minutes)
    indicator1 = Stochastic[5,2](close)
    c1 = (indicator1 >= 80)
    TIMEFRAME(1 hour)
    indicator2 = MACDline[12,26,9](close)
    c2 = (indicator2 <= 0)
    TIMEFRAME(4 hours)
    indicator3 = ExponentialAverage[9](MACDline[12,26,9](close))
    indicator4 = MACDline[12,26,9](close)
    c3 = (indicator3 >= indicator4)
    TIMEFRAME(default)
    short= c1 AND c2 AND c3 
    //LONG
    TIMEFRAME(15 minutes)
    indicator1 = Stochastic[5,2](close)
    c1a = (indicator1 <=20)
    TIMEFRAME(1 hour)
    indicator2a = MACDline[12,26,9](close)
    c2a = (indicator2a > 0)
    TIMEFRAME(4 hours)
    indicator3a = ExponentialAverage[9](MACDline[12,26,9](close))
    indicator4a = MACDline[12,26,9](close)
    c3a = (indicator3a <= indicator4a)
    TIMEFRAME(default)
    long= c1a AND c2a AND c3a
    
    if long then 
    criteria=1
    elsif short then 
    criteria=-1
    endif
    
    scREENER[long or short](criteria as "long or short?")

     

    thetragiccircle and robertogozzi thanked this post
    #55012 quote
    thetragiccirclethetragiccircle
    Participant
    Junior

    Thank you so much Nicolas, it now works perfectly.

Viewing 3 posts - 46 through 48 (of 48 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

Advice on combining conditions


ProScreener: Market Scanners & Detection

New Reply
Author
Summary

This topic contains 47 replies,
has 3 voices, and was last updated by thetragiccirclethetragiccircle
8 years, 9 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 10/22/2017
Status: Active
Attachments: 7 files
ProRealCode ProRealCode
Loading...