Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close Non-Strategy Positions From Strategy

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

    Close Non-Strategy Positions From Strategy

    Hi

    I am working on an idea where I use different time frames throughout the day. Say 1 minute from 6:30-7:30 and then 5 minute from 7:30 to close.

    My thought is to have two different instances of the strategy with the appropriate time frame set.

    What I'm wondering is, say I am now in the 7:30 instance, but I have a long position still open from the 6:30 instance. Then my 7:30 instance generates a sell signal, will calling EnterShort reverse the position for me as it would if the current position had been opened from the same strategy?

    Or will it just open an additional position, and I wouldn't have any control over the existing position from my new instance of the strategy?

    #2
    Hello calebsandfort,

    Thanks for your post.

    If you are running two strategies on the same instrument and the same account your account position will likely not reflect the strategy position. In your example of being 1 long on the first strategy, when the 2nd strategy goes short, it will close the account position (you will be flat), however both strategies will continue running as if they were still long and still short and will continue placing live orders based on their "strategy" position.

    Strategies run without regard to any other strategy and are not aware of each other. There are two solutions, one would be to open a second account and assign each strategy to a different account as this will prevent one affecting the other. Alternatively, combine the two strategies into one by adding a 5-minute data series and using a time filter in your code. By using a single instance your code can then determine the current position of the strategy/account and decide to or not to place an order.

    Note; If you decide to add the 5-minute data series you would be creating a multi-timeframe script and will require different considerations in methods and properties, I have linked a reference to multi-timeframe coding.

    References:


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    72 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X