Buy two (or three) bars after the signal

Forums ProRealTime English forum ProOrder support Buy two (or three) bars after the signal

Viewing 4 posts - 1 through 4 (of 4 total)
  • #12793
    ML

    Hi everybody,

    I have a quick question for you. I just built a simple Trading System. I would like to put in code something like “when this condition happen buy two (or three) bars after the signal happened”.

    Would it be possible?

    Thanks a lot in advance

    ML

    #12802

    Hi, you can compare the BARINDEX between the current one and the one when your signal occurred.

     

    #12815
    ML

    Hi Nicolas!

    Can you explain better?

    Let say I have something like:

    xxx=golong+goshort
    if xxx=1 then
    buy 1 contracts at market nextbaropen
    elsif xxx=-1 then
    sellshort 1 contracts at market nextbaropen
    endif

    My idea would be to write something like “buy 1 contracts at market nexttwobaropen” but I know it does not exist!

    How can I use the BARINDEX  comand?

    Thanks a lot in advance for your reply!

     

    ML

     

    #12816

    nextbaropen is depreciated, it is not used anymore in the PRT language.

    You can save the barindex when your signal occur and then compare its value with the current barindex one. Of course your ‘golong’ signal should occur only once in the past, otherwise the ‘signalbar’ variable would be constantly renewed with the current barindex.

    Please take the time to understand before asking your next question 🙂

     

Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login