order validity – signal to be valid 4 following bars

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #64677 quote
    George65
    Participant
    Senior

    Hi,

    can someone help how to code how many bars an order is valid?

    For example buy setup:

    I get the buy signal on current bar, and I want the signal to be valid 4 following bars, and if the buying condition is not met, delete the order.

    Thank you!

    George

    #64682 quote
    Nicolas
    Keymaster
    Master

    You can test if your signal was true in the last X bars:

    (let’s say your signal condition is a variable named “signal”):

    test = summation[4](signal>0)>0
    
    if test then 
     buy 1 contract at market 
    endif

    If “signal” was true at least 1 time during the last 4 bars, then the condition is still true.

    #64684 quote
    George65
    Participant
    Senior

    Thank you Nicolas, sorry it is my English. I did not mean that.

    Try to clarify:

    I get a buy signal on current bar, let’s say the signal is high (0) › high (1)

    I do not want to buy at market, but at limit price, lets say “buy 1 contract at low(1) + range(1)• 0,7 stop”.

    And I want the order to be valid 4 bars after the entry signal if the price comes lower. If not, after monitoring 4 bars, delete the order.

    Thanks again!

    #64686 quote
    Leo
    Participant
    Veteran
    #64697 quote
    George65
    Participant
    Senior

    Thanks Leo, I think a understand

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

order validity – signal to be valid 4 following bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
George65 @george65 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by George65
8 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/07/2018
Status: Active
Attachments: No files
Logo Logo
Loading...