Advice on combining conditions

Viewing 3 posts - 46 through 48 (of 48 total)
  • Author
    Posts
  • #54493 quote
    thetragiccircle
    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
    Nicolas
    Keymaster
    Master

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

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 thetragiccircle
8 years, 3 months ago.

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