Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit position condition

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Exit position condition

    Hi,
    I am trying to do some backtest with strategy analyzer. My idea is to enter and exit position based on indicator values - my indicator has two values: lower and upper boundry (these boundries do not change during the session).
    When data series gets below lower boundry and than start raising I want to enter with long position, which I managed this way:
    - condition: Close[0] < lower boundry
    - do: EnterLongStop(DefaultQuantity, lower boundry,"long_position")

    Once I enter such position I do not want to sell it until price reaches upper boundry, but this I cannot accomplish in Strategy builder. I tried:
    - condition: currentMarketPosition == Long
    - do: ExitLongStop(DefaultQuantity, upper boundry, "exit_long_position")
    But this does not work. When I tried just "Exit Long Position" Strategy Analyzer did exit the position on next bar. Any other type of exittin Long position was unsuccesfull.

    See atteched picture - it should enter twice for long, but instead the first long expired on close of session.

    Thank for answer
    Attached Files

    #2
    Originally posted by antonek View Post
    Hi,
    I am trying to do some backtest with strategy analyzer. My idea is to enter and exit position based on indicator values - my indicator has two values: lower and upper boundry (these boundries do not change during the session).
    When data series gets below lower boundry and than start raising I want to enter with long position, which I managed this way:
    - condition: Close[0] < lower boundry
    - do: EnterLongStop(DefaultQuantity, lower boundry,"long_position")

    Once I enter such position I do not want to sell it until price reaches upper boundry, but this I cannot accomplish in Strategy builder. I tried:
    - condition: currentMarketPosition == Long
    - do: ExitLongStop(DefaultQuantity, upper boundry, "exit_long_position")
    But this does not work. When I tried just "Exit Long Position" Strategy Analyzer did exit the position on next bar. Any other type of exittin Long position was unsuccesfull.

    See atteched picture - it should enter twice for long, but instead the first long expired on close of session.

    Thank for answer
    That looks like you are using the override that identifies an Exit signal by specifying the entry signal name. Your entry signal name is "long_position", but you asking the Exit order to exit the order that was entered with the name "exit_long_position". There is no such position.

    If you want to exit a position that was entered with a signal called "long_position", then you need to tag the Exit with the exact same signal name, "long_position".

    I will surmise that you are trying to distinguish the orders by some kind of tagging. In that case, use IOrders, and name them according to your delights.
    Last edited by koganam; 11-25-2012, 05:08 PM.

    Comment


      #3
      I tried setting up the conditions through strategy builder. Can you check what is worng with it?

      What is IOrders?

      Thanks
      Attached Files
      Last edited by antonek; 11-26-2012, 01:48 PM.

      Comment


        #4
        Originally posted by antonek View Post
        I tried setting up the conditions through strategy builder. Can you check what is worng with it?

        What is IOrders?

        Thanks
        Your description implied that you wanted a "Target", but your pictures show you entering a "Stop".

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        66 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        41 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        24 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        27 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        53 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X