Help for code Screener on two time frames using Parabolic, Bollinger, MACD

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #60551 quote
    Petru
    Participant
    Junior

    Hi Again,

    I would appreciate your assistance for a code screener. I have a good talent to complicate things.

    For this screening I must use 7 and 23 period moving averages, Parabolic SAR, MACD, Stochastic and Bollinger Bands on two timeframes: daily and weekly. The settings of the indicators are a little bit different:

    1. 7 and 23 period simple moving averages
    2. MACD (9, 17,6)
    3. Stochastic (15, 5, 5) – method: exponential
    4. Parabolic, default settings (0.02, 0.02, 0.2)
    5. Bollinger Bands, default settings (20,2), the only exception is that an average of high, low and close must be used.

    Now I write some abbreviations to avoid writing long sentences.

    1. Price (1) = today’s price at close
    2. Price (8) = price at close in the 8th day (8 days ago)
    3. Parabolic SAR (1) = parabolic SAR as today
    4. M7 (1) = 7 period simple moving average as today at close
    5. M23 (1) = 23 period simple moving average as today at close
    6. M7 (2) = 7 period simple moving average as yesterday at close
    7. M23 (2) = 7 period simple moving average as yesterday at close
    8. UB (1) = upper Bollinger Band as today
    9. UB (2) = upper Bollinger Band as yesterday
    10. LB (1) = lower Bollinger Band as today
    11. LB (2) = lower Bollinger Band as yesterday
    12. (UB-LB) = difference between upper and lower Bollinger Bands
    13. Max(UB-LB)50 = largest difference between upper and lower Bollinger Bands in the last 50 periods
    14. Max(UB-LB)100 = largest difference between upper and lower Bollinger Bands in the last 100 periods
    15. BMA = Bollinger moving average
    16. %K = slow down fast %K by exponential moving average
    17. %D = slows down %D by exponential moving average – see attached excel spreadsheet for calculations)

     

     

    To enter

    Indicator Timeframe – week Timeframe – day
    price Price (1) > price (8)

    Price (1) > parabolic SAR (1)

    Price (1) > price (8)

    Price (1) > parabolic SAR (1)

    7/23 M7 (1) > M23 (1)

    M7(1) > M7 (2)

    M23 (1) > M23 (2)

    M7 (1) > M23 (1)

    M7(1) > M7 (2)

    M23 (1) > M23 (2)

    Bollinger Bands UB )1) > UB (2)

    (UB – LB) < or = 0.7*(UB – LB)50

    UB )1) > UB (2)

    (UB – LB) < or = 0.5*(UB – LB)100

    LB (1) < LB (2)

    MACD MACD > Signal MACD > Signal
    Stochastic %K > %D %K > %D
    Volume 500 000

     

    To exit

    Indicator Timeframe – week Timeframe – day
    Price, Parabolic SAR and Bollinger moving average Parabolic (1) > price (1) (price closes bellow parabolic SAR)

    BMA (1) > Price (1) (price closes bellow Bollinger moving average)

     

    Thank you very much,

    Petru

    Example-Stochastic.xlsx
    #60571 quote
    JC_Bywan
    Moderator
    Master

    Hi, in that case I’m moving your post to the pro-screener forum, where it has more chances to be read by members able to help in that area

    For future reference, the list of PRC forums to choose from is here: https://www.prorealcode.com/forums/

    Regards

    #60702 quote
    Petru
    Participant
    Junior

    Hi,

    I am considering myself very lucky that I discovered this forum with lots of great people that share their ideas and very helpful.

    I am using excel spreadsheets to back test my idea (if some is interested please let me know and I will share it with you), but to find opportunities unfortunately it is impossible to screen the market using excel. My programming skills are not great, but I determined to learn even I am not young.

    I would like to explain my previous message. I want to screen on two different timeframes, week and day, in a bullish market.

    On both time frames parabolic should serve as support and price at close must be higher than the price at close on the 8th day. The short (7 period) and long (23 period) simple moving averages should trend upward direction with short moving average above long moving average. MACD must be greater than signal and for stochastic %K greater than %D (not necessarily on daily timeframe).

    On daily timeframe we should see a Bollinger squeeze, upper and lower bands should be at minimum compared to the past 100 days. A bullish closing price above the upper Bollinger band with a divergence of bands and a %K greater than %D for stochastic should give a buy signal.

    For exit I am going to use excel since I feel more comfortable, this until I will improve my programming skills. Exit signal will be given when parabolic SAR becomes resistance and price closes below Bollinger moving average on the weekly timeframe.

    I know it is a very very difficult to get to taste the success, but this is something that I like. Thank you all for making this forum wonderful.

     

    Best Regards,

     

    Petru

    #60839 quote
    Nicolas
    Keymaster
    Master

    Thanks for the explanation @Petru, let’s see what I can do for help.

    Petru thanked this post
    #60840 quote
    Nicolas
    Keymaster
    Master

    Here is the code of the screener you requested:

    timeframe(weekly)
    maw7 =average[7]
    maw23 = average[23]
    ubolw = BollingerUp[20](close)
    lbolw = BollingerDown[20](close)
    wmacd = macd[12,29,9]
    wsmacd = exponentialaverage[9](wmacd)
    wsto = Stochastic[14,3](close)
    wssto = average[6](wsto)
    w1 = close>close[8]
    w2 = close>SAR[0.02,0.02,0.2]
    w3 = maw7>maw23
    w4 = maw7>maw7[1]
    w5 = maw23>maw23[1]
    w6 = ubolw>ubolw[1]
    w7 = (ubolw-lbolw)<=0.7*(highest[50](ubolw)[1]-lowest[50](lbolw)[1])
    w8 = wmacd>wsmacd
    w9 = wsto>wssto
    wconditions = w1 and w2 and w3 and w4 and w5 and w6 and w7 and w8 and w9
    
    timeframe(daily)
    mad7 =average[7]
    mad23 = average[23]
    ubold = BollingerUp[20](close)
    lbold = BollingerDown[20](close)
    dmacd = macd[12,29,9]
    dsmacd = exponentialaverage[9](dmacd)
    dsto = Stochastic[14,3](close)
    dssto = average[6](dsto)
    d1 = close>close[8]
    d2 = close>SAR[0.02,0.02,0.2]
    d3 = mad7>mad23
    d4 = mad7>mad7[1]
    d5 = mad23>mad23[1]
    d6 = ubold>ubold[1]
    d7 = (ubold-lbold)<=0.5*(highest[100](ubold)[1]-lowest[100](lbold)[1])
    d8 = dmacd>dsmacd
    d9 = dsto>dssto
    d10 = volume>500000
    dconditions = d1 and d2 and d3 and d4 and d5 and d6 and d7 and d8 and d9 and d10
    
    screener [wconditions and dconditions] sort by Volume
    #60899 quote
    Petru
    Participant
    Junior

    Thank you very much Nicolas,

    I just got home and now I am trying your code. Thank you again for helping me.

     

    Best Regards,

     

    Petru

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

Help for code Screener on two time frames using Parabolic, Bollinger, MACD


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Petru @petru Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by Petru
8 years, 1 month ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 01/26/2018
Status: Active
Attachments: 1 files
Logo Logo
Loading...