Can I Do This In A Single Expression?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #32573 quote
    Geester
    Participant
    Junior

    Hi,

    I’m trying to emulate some screening code originally written for another platform.

    Using something like this: MAXH15.4

    The other platform interprets this as give the Maximum Value of the High of the bar(s) over 15 bars, starting 4 bars ago.Or …

    MINL21.3

    Give the Minimum Value of the Low of the bar(s) over 21 bars, starting 3 bars ago.

    I appreciate that there are MIN/MAX functions available in PRT but the documents suggest they accept as lists of literal values. To have to iterate in loops to arrive at values like this would be very cumbersome when you want (and I want) to replicate filters like this:

    ((L1 = MINL4) OR (L2 = MINL4) OR (L3 = MINL4) ) AND
    ( (MAXC3 < MAXC4.3)) AND
    ( (H3 = MAXH15.4) OR (H4 = MAXH15.4) OR (H5 = MAXH15.4) OR (H6 = MAXH15.4) OR (H7 = MAXH15.4) ) AND (((MAXH4.3 – MINL4) / (MAXH4.3 – MINL21.3) > .23) AND ((MAXH4.3 – MINL4) / (MAXH4.3 – MINL21.3) < .62) ) AND
    ((AVGH3.5) > (AVGH3.8 ) AND (AVGH3.8 ) > (AVGH3.13) AND (AVGH3.13) > (AVGH3.18 ))

    Any ideas as to the best approach to combine bar sequences with functions as expressions?

    Many thanks.

    #32599 quote
    Nicolas
    Keymaster
    Master

    Maximum Value of the High of the bar(s) over 15 bars, starting 4 bars ago

    That could be coded like this:

    value = highest[15](high)[4]

    Give the Minimum Value of the Low of the bar(s) over 21 bars, starting 3 bars ago.

    and the same way to find a lowest low of X bars ago:

    lowestlow = lowest[21](low)[3]

    Hope it helps you sort all the rest of your code!

    #32601 quote
    Geester
    Participant
    Junior

    Awesome! Thank you Nicolas 🙂

    #32633 quote
    Geester
    Participant
    Junior

    Hi Nicolas,

    Can you tell me what is wrong with this syntax?

    expr2 =  higest[4](price)[3]

    See attached image for error details.

    Thanks! 🙂

    syntax_error.png syntax_error.png
    #32637 quote
    GraHal
    Participant
    Master

    Highest high or lowest low , but highest price??  Is Price even an allowed term?

    High, Low, Open, Close and Mid Price and you’d have to calculate Mid from (Low + (High-Low/2)) ??

    #32638 quote
    Geester
    Participant
    Junior

    My bad. I had tried so many combinations to make this work, I mistyped. However, it still doesn’t work. Consider this:-

    expr1 = lowest[4](low) // This works and, the “lowest” word is in GREEN

    expr2 = higest[3](close) // This fails with the red squiggle in the editor window. Also, the “highest” word is in WHITE

    Ideas?

    #32639 quote
    Geester
    Participant
    Junior

    Wow, I’ve got it working now. I overtyped the word “highest” and it turned GREEN. Syntax squiggle disappeared?? Very strange! 🙂

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

Can I Do This In A Single Expression?


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Geester @geester Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by Geester
8 years, 10 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 04/19/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...