Coding an entry for when PRT bands turn from red to green?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #170461 quote
    Moose
    Participant
    New

    Hi! I’ve been trying to use PRT bands in my trading systems but have a problem with coding an entry for when the bands switches from red to green. The start of every green period is obviously when price closes above the upper band, however this occurs many times during a green period as well. I would lika a signal that only activates when it turns from red to green. Can I somehow use the color itself and if the indicator returns green or red? But how should I code that?

    #170476 quote
    nonetheless
    Participant
    Master

    I don’t normally use PRT bands so someone more familiar with them may know a better way of doing this, but it looks like a change of the medium-term line mostly leads to a change in the colour zone, which means you could try this:

    // Conditions to enter long positions
    indicator1 = PRTBANDSMEDIUMTERM
    c1 = (indicator1 > indicator1[1])
    Moose thanked this post
    #170478 quote
    Moose
    Participant
    New

    Thank you for your answer. I’ve scrolled through the graf and it seems that when PRTBANDMEDIUMTERM = PRTBANDSDOWN a color change is prompted from red to green. Could this relationship be the “secret” behind all the red to green switches?

    #170485 quote
    nonetheless
    Participant
    Master

    That seems to be the case rising, but not falling.

    On 1 hour DAX, the medium line turned down at 1900 yesterday but it was nowhere near the upper or lower lines. At 20:00 the colour zone turned red.

    Similarly May 18 14:00

    In any case, I doubt if you could use this on it’s own as an entry condition as it’s very laggy – perhaps in conjunction with some other indicator.

    #170535 quote
    nonetheless
    Participant
    Master

    had another look at this, the band changes colour when the candle closes above or below the upper/lower line. so the code would be:

    //red to green
    indicator1 = PRTBANDSUP
    c1 = (close > indicator1)
    
    //green to red
    indicator2 = PRTBANDSDOWN
    c2 = (close < indicator2)
    
    #170550 quote
    Moose
    Participant
    New

    Yes, that is true. When changing from green to red that is the only condition needed.

    Another issue would be to identify when price is in a “green trend”. For example that a trade can only be made if the overall trend is in “green”. We have identified how to code the switch between trends but how do we determine that the price is in the right trend; green or red?

    #170594 quote
    PastaPesto
    Participant
    Veteran

    Hi Moose

    Sorry but I didnt manage to insert link, so I just write it below 🙂 If I understand your question correct I would have done the below:

    if close>PRTBANDSUP then
    Greentrend=1
    endif
    if close<PRTBANDSDOWN then
    Greentrend=0
    endif

    And then use greentrend as one of the rules rule for order. The opposite code ofcourse for “redtrend”. Hope that helps.

    Moose thanked this post
    #170600 quote
    Moose
    Participant
    New

    Hej PastaPesto!

    Yes, thank you. That is a very good solution to use 1 or 0 as the on and off switch for trends 🙂 Perfect.

    #170653 quote
    murre87
    Participant
    Senior

    Hi @Moose
    I think this is a very intresting idea.
    If u come up with a code i would be intressted to test it

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

Coding an entry for when PRT bands turn from red to green?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Moose @doctormoose Participant
Summary

This topic contains 8 replies,
has 4 voices, and was last updated by murre87
4 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/26/2021
Status: Active
Attachments: No files
Logo Logo
Loading...