Entry at second touch of EMA code?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #120237 quote
    Wing Tai Tin
    Participant
    New

    hi guys,

    I would like to know how to write the code which is when the price touch ema 2 times, then the entry position should be at the second touching point on ema.

    so anyone can tell me how to write?

    thank you so much

    #120239 quote
    Vonasi
    Moderator
    Master

    Wing Tai Tin – Welcome to the forums. Please try to post in the correct forum with future topics. The ProOrder forum is the place for auto strategy related questions. I have moved your post. 🙂

    Also please use meaningful topic titles – I have changed yours.

    #120240 quote
    robertogozzi
    Moderator
    Master

    Try this (not tested):
    [scode]
    LookBack = 10
    MyEma = average[20,1](close)
    // LONG example
    LongCond = (close > MyEma) and (low <= MyEma) and (summation[LookBack](low <= MyEma)[1]) If LongCond And not OnMarket Then Buy 1 contract at Market Endif [/scode]

    #120241 quote
    robertogozzi
    Moderator
    Master

    If you want to make sure price has also never closed below MyEma in the last LookBack bars, replace line 4 with:
    [scode]
    LongCond = (low <= MyEma) and (summation[LookBack](low <= MyEma)[1]) And (summation[LookBack](close >= MyEma) = LookBack)
    [/scode]

    #120255 quote
    Wing Tai Tin
    Participant
    New

    thank you so much

    #120256 quote
    Wing Tai Tin
    Participant
    New

    thank you for your helping

    but i dont really understand what is the difference between “longonmarket” “onmarket” “shortonmarket”

    also, “if” and “if not”

    for example:
    if i want to entry buy position, i should
    1. if longonmarket/onmarket then or
    2. if not longonmarket/onmarket then

    im so confuse how to use those codes.

    thank you very much

    #120257 quote
    Vonasi
    Moderator
    Master
    #120271 quote
    GraHal
    Participant
    Master

    i dont really understand what is the difference between “longonmarket” “onmarket” “shortonmarket”

    Sounds like you need basic training? Have you ever coded before? It’s okay … I and many others on here hadn’t coded before we started using PRT .

    Try reading the PRT Manual and / or do Nicolas video course.

    https://www.prorealtime.com/en/pdf/probacktest.pdf

    https://www.prorealcode.com/programming-with-prorealtime/

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

Entry at second touch of EMA code?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 7 replies,
has 4 voices, and was last updated by GraHal
5 years, 12 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/23/2020
Status: Active
Attachments: No files
Logo Logo
Loading...