And Or logic sequence

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #213574 quote
    ktkt
    Participant
    New

    Hi Experts,

    I need some guidance figuring out the AND & OR logic execution.  I got an entry with code 1, but not code 2 and code 3 stated below. I couldn’t figure out how did that happen with code 1.

    // code 1:

    if x OR y AND z then

    buy 1 shares at market

    // code 2:

    if (x or y) AND z then

    buy 1 shares at market

    // code 3:

    if x AND z then

    buy 1 shares …

    if y AND z then

    buy 1 shares …

    #213580 quote
    GraHalGraHal
    Participant
    Master

    Just in case it was random (with code 1) can you reproduce (a few times) entry with code 1?

    #213592 quote
    ktkt
    Participant
    New

    Hi Grahal, in Backtest yes code 1 resulted entry 10/10. Let me relaunch the PRT to test it.

    In principle (and by design), how should code 1 run? Eg. it is (x or y) and z? x or (y and z)?  Note,  The brackets are not written with code 1, I just put them here to elaborate the logic.

    Thanks!

    #213593 quote
    ktkt
    Participant
    New

    Sorry, I forgot to mention code 1 did resulted an entry in real trade with condition y.

    #213595 quote
    GraHalGraHal
    Participant
    Master

    Deleted as after editing the same text appeared again as another post??

    #213596 quote
    GraHalGraHal
    Participant
    Master

    code 1: if x OR y AND z then

    code 2: if (x or y) AND z then

    Both above mean the same in PRT Code and should gives the same Trades.

    code 3 : X AND Z

    code 4: Y AND Z

    Either of above should give some Trades coincident with code 1 and code 2, but not the same Qty of Trades as either code 1 or code 2 … assuming you use either code 3 OR code 4 in 1 System.

    If you use code 3 and code 4 in 1 System (as x and z OR y and z) then the results should be the same as using either code 1 or code 2.

    #213610 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I suggest to use parenthesis to avoid any misunderstanding when having to mix AND and OR (I always do that).

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

And Or logic sequence


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
kt @kiatthong Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by robertogozzirobertogozzi
3 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/21/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...