PRT bands strategy

Forums ProRealTime English forum ProOrder support PRT bands strategy

Viewing 6 posts - 1 through 6 (of 6 total)
  • #210675

    Hi everyone,

    It’s a week that I’m trying to understand Probuilder language, so it’s very difficult for me. I’m trying a strategy, very simple, that work with PRT bands when trend change from red to green.

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    // Conditions to enter long positions
    EXP1 = ExponentialAverage[1](close)
    up = PRTBANDSUP
    indicator8 = ExponentialAverage[50](close)
    c1 = (EXP1 CROSSES OVER up )
    EXP50 = ExponentialAverage[50](close)
    EXP100 = ExponentialAverage[100](close)
    c2 = (EXP50 >= EXP100)
    if close crosses over up and trend<=0 then //le prix casse la bande supérieure
    trend=1
    elsif close crosses under dn and trend>=0 then //le prix casse la bande inférieure
    trend=-1
    ENDIF
    c4 = trend<>trend[1]
    IF c1 and c2 and c4 then
    BUY 10 SHARES AT MARKET
    ENDIF

     

    // Conditions to exit long positions
    EXP1 = ExponentialAverage[1](close)
    dn = PRTBANDSDOWN
    c5 = (EXP1 CROSSES UNDER dn )

    IF c5 and c4 THEN
    SELL AT MARKET
    ENDIF

    // Stops and targets
    SET STOP pLOSS 4

     

    probably there are many mistakes, but I’m just trying to understand the method. I’d like to use the strategy for medium-large stocks. I’d need a help to improve the strategy this way:

    instead of Exp moving average as filter, I’d like an indcator, similar to Zig zag or Zig Zag itself, that make a condition to enter long only if there is a higher low or at least a low higher than one of the two previous lows (better if I can set the percentage of variation to determine highs and lows, in order to avoid small fluctuation).

    in alternative it’d be great if I could use as condition something similar to ” stopping volume”, so for example looking at the previous 20 candles, determine the most bearish climax candles and to set a condition only if the last climax bearish candle have a ratio volume/body greater than the previous climax bearish candle.

    more difficult is to determine exit strategy. actually it’s not good, it’s would be great if it could set a take profit when the price cross over (not at close) the upper band but Icannot make it work. I’d like to add also a trailing stop loss in a defined percentage under the last higher low.

    I know I ask a lot but if someone can help me it would be great

     

    thank’s

     

    Alessio B.

     

    #210710

    Built-in ZigZag is a repainting indicator which cannot be used in autotrading.  This one can be used, instead https://www.prorealcode.com/prorealtime-indicators/fractals-zigzag/.

    I will try to help you asap.

     

    #210735

    Thank you Roberto, It’d be amazing if you could help me, that could help me to better understand how to prepare a strategy

    Alessio

    #210792

    Hi Roberto,

    with my poor knownledge of program, I added short entry but It doesn’t work as I want; First of all for some reason it opens positions even if close of price is under EXP100, and it doesn’t open short position at all. I don’t know what I’m doing wrong. I summarize what I’d like to obtain:

    Long if close of price up EXP100 or Short close under EXP100,in alternative  a condition to enter long only if there is a higher low or at least a low higher than one of the two previous lows (better if I can set the percentage of variation to determine highs and lows, in order to avoid small fluctuation).

    An additional condition something similar to ” stopping volume”, so for example looking at the previous 20 candles, determine the most bearish climax candles and to set a condition only if the last climax bearish candle have a ratio volume/body greater than the previous climax bearish candle.

    more difficult is to determine exit strategy. actually it’s not good, it’s would be great if it could set a partial 50% take profit when the price cross over (not at close) the upper band and the rest when it closes under the band, the opposite for short. I’d like to add also a moving stop loss in a defined percentage under the last higher low.

    Thank you very much for everything

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    EXP1 = ExponentialAverage[1](close)
    up = PRTBANDSUP
    dn = PRTBANDSDOWN

    if close crosses over up and trend<=0 then
    trend=1
    elsif close crosses under dn and trend>=0 then
    trend=-1
    ENDIF

    c1 = (EXP1 CROSSES OVER up )
    EXP50 = ExponentialAverage[50](close)
    EXP100 = ExponentialAverage[100](close)
    c2 = close >= exp100
    c3 = trend<>trend[1]

    // Conditions to enter long positions
    IF NOT SHORTONMARKET AND c1 and c2 and c3 then
    BUY 10 SHARES AT MARKET
    ENDIF

    // Conditions to exit long positions
    c4 = (EXP1 CROSSES UNDER dn )
    IF c3 and c4 THEN
    SELL AT MARKET
    ENDIF

    // Conditions to enter short positions
    c4 = (EXP1 CROSSES UNDER dn )
    c5 = close <= exp100
    IF NOT LONGONMARKET AND c4 and c5 then
    SELL 10 SHARES AT MARKET
    ENDIF

    // Conditions to exit short positions

    IF c1 and c3 THEN
    BUY AT MARKET
    ENDIF

    // Stops and targets
    SET STOP pLOSS 4

    #210793

    the conditions are added at the close upper band of PRT bands (for long positions) and short at the close of lower band PRT bands (when the trend change from red to green and viceversa)

    thank’s

    #213938

    Sorry for the long delay!

    Firstly, to enter/exit a trade you must use:

    1. BUY   to enter a Long trade
    2. SELL to exit   a Long trade
    3. SELLSHORT to enter a Short trade
    4. EXITSHORT to exit    a Short trade.

    Secondly, I can’t understant the use of EXP1, as it is the same as CLOSE (the closing price).

    Thirdly, 4 pips is a very tiny SL and it may be less than the minimum requirements by your broker. You’d better check with them what that valus is for the instruments/assets you want to trade.

    Fourthly, I can’t understand “it’s would be great if it could set a partial 50% take profit when the price cross over (not at close) the upper band and the rest when it closes under the band“, as it enters Long when the price crosses over the upper band, how can it take some profits when it CROSSES OVER it?

    Anyway, this is the code I have modified:

     

     

     

Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login