Syntax Explanation Please

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

    Hello There,

    In some code I have been studying, it has the following line:

    body=close-open

    Later in the code, it then refers to:

    body[2]<0

    How has the “body” variable suddenly become an array-like indexable variable? The code in question comes from the following:

    Candlesticks patterns indicator

    I’m new to PRT and its code so excuse the newbie questions! 🙂

    Many thanks.

    #31547 quote
    robertogozzi
    Moderator
    Master

    It’s not an array, PRT doesn’t have them.

    It means the value of the expression identified by BIDY, 2 bars ago. It’s like writing:

    (close[2] - open[2]) < 0
    #31638 quote
    Geester
    Participant
    Junior

    Hi Roberto,

    body=close-open

    PRT doesn’t just assign the result of the above to “body”, it actually “remembers” the expression for further access via the bar count indexer?

    Wow. That’s neat 🙂

    Cheers.

    #31644 quote
    robertogozzi
    Moderator
    Master

    Yes, and you can use that feature in as many ways as you may need; if you need, for instance, to have

    RSI[14]  > 50

    now and the previous bar you may write:

    RsiValue = RSI[14](close)
    Condition = RsiVallue > 50
    If Condition AND Condition[1] THEN
        .
        .
        .
    ENDIF
    
    Nicolas thanked this post
    #31646 quote
    Geester
    Participant
    Junior

    Thank you, Roberto! I feel a little more confident now, given your explanation! 🙂

    Cheers.

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

Syntax Explanation Please


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Geester @geester Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Geester
8 years, 11 months ago.

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