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.
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
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.
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
Thank you, Roberto! I feel a little more confident now, given your explanation! 🙂
Cheers.