Percentile Code Error

Forums ProRealTime English forum ProOrder support Percentile Code Error

Viewing 4 posts - 1 through 4 (of 4 total)
  • #253169

    Hi, I was wondering if anyone can get this Percentile code to work:
    VolRank = Percentile[60](Volume, 75) // 75th percentile of past 60 bars

    I tried many iterations but i am not sure why it won’t work? Also what happened to the add code icon?

    Cheers!

    // ============================================================

    // Strategy: bearish_engulf_MA20_25pct

    // Description: Short on bearish engulfing below MA20 with volume filter

    // ============================================================

    // — Parameters

    DEFPARAM CumulateOrders = False

    DEFPARAM PreLoadBars = 60

    StopPercent = 2.0 // change to 1.0, 3.0, etc. as needed

    Capital = 1000

    // — Indicators

    MA20 = Average[20](Close)

    VolRank = Percentile[60](Volume, 75) // 75th percentile of past 60 bars

    // — Bearish Engulfing detection

    BearishEngulf = (Close[1] > Open[1]) AND (Close < Open) AND (Open > Close[1]) AND (Close < Open[1])

    // — Entry condition

    ShortCondition = BearishEngulf AND (Close < MA20) AND (Volume > VolRank)

    // — Position management

    If ShortCondition THEN

    SellShort 1 CONTRACT AT MARKET

    ENDIF

    // — Stop-loss in price terms

    If ShortOnMarket THEN

    EntryPrice = ShortPrice

    StopPrice = EntryPrice * (1 + StopPercent / 100)

    SET STOP pLOSS (StopPercent * Capital / 100)

    ENDIF

    // — Exit end-of-day (if not stopped)

    If ShortOnMarket AND BarIndex > TradeIndex THEN

    ExitShort AT Close

    ENDIF

    #253177

    what happened to the add code icon?

    If we press Ctrl + F5 (clear cache for PRC website only) before we start typing then you should see the blue  ‘Insert PRT Code’ icon at the far right of the top toolbar?

    Trick is remembering to Ctrl + F5 BEFORE typing anything at all!

    If you Ctrl + F5 after typing then you lose whatever you just typed!

    1 user thanked author for this post.
    #253178
    JS

    Hi,

    You use “Percentile[60](Volume,75)” as an indicator, but this indicator does not exist (by default) in PRT…

    You will first have to calculate the “Percentile” yourself…

    2 users thanked author for this post.
    #253207

    Hi. Here you have an example of percentile calculation:

    1 user thanked author for this post.
Viewing 4 posts - 1 through 4 (of 4 total)

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