Register Login
Forums    May 18, 2012
TradersStudio Forums
How to make TradePlans accept rebalancing of positions?
Last Post 06-01-2010 11:50 PM by mur ang. 3 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Thomas Stridsman
New Member
New Member
Posts:9

--
05-19-2010 06:58 AM

    Yesterday I posted a long message with a few questions. I still can't see it in the Forum, so I guess I have to rewrite. Here goes...

    I would like to rebalance my open positions within a long term trend following system. Since there is no function like this:

    SetTradeRisk(PointRisk)
    Balance("LA1", 1, 0, CloseEntry, Day)

    (Where new position will keep the position name, and account equity would be tracked by the TradePlan)

    That would just buy or sell the net between the current open position and the desired new position, I have worked with this:

    TradesAllowed = AllOrders
    If TradeDayOfMonth = 1 Then
        SetTradeRisk(PointRisk)
        ExitLong("RLA", "LA", GetCurrentSize("LA"), 0, CloseExit, Day)
        Buy("LA", 1, 0, CloseEntry, Day)

    This works fine within a Session, but not within a TradePlan, which will not recognize the buy order. Changing the buy order to:

    Buy("LA", 1, 0, Market, Day)

    still works within a Session but not within a TradePlan. What's up with this? Why doesn't the TradePlan accept all trades generated by the Sessions? Are there any other instances where a TradePlan might skip trades generated within the Sessions?

    Changing the name of the buy order works sometimes, but only if the name is kept within quotes as opposed to stored as a variable, be it String, Integer or BarArray. For example, this still works fine within a Session, if n has been defined as a BarArray:

    If TradeDayOfMonth = 1 Then
        ExitLong("RLA" + n, "LA" + n, GetCurrentSize("LA" + n), 0, CloseExit, Day)
        n = n + 1
        Buy("LA" + n, 1, 0, CloseEntry, Day)

    Producing a series of trades for the entire length of the position that could look like this:

    Buy/Sell          Entry date          Entry name          Exit date          Exit name

    Buy                 91-01-16           LA1                   91-02-01         RLA1
    Buy                 91-02-01           LA2                   91-03-01         RLA2
    Buy                 91-03-01           LA3                   91-04-01         RLA3
    Buy                 91-04-01           LA4                   91-04-12         XLA4
    Sell                  91-05-09          SB1                    And so on


    (Depending on the money management used within the Session the number of contracts bought and sold would vary correctly)

    But within a TradePlan the same sequence of trades would be reduced to:

    Buy/Sell          Entry date          Entry name          Exit date          Exit name

    Buy                 91-01-16           LA1                   91-02-01         RLA1
    Sell                  91-05-09          SB1

    My question is, how do I make this work within both a Session and a TradePlan? And again I need to ask, why isn't the TradePlan accepting all trades from the Session as it is?

    /Thomas Stridsman

    ps. I too have long missed the the possibility to use multiple SetTradeRisk. Or at least individually for long and short trades. The function could work like this SetTradeRisk(”Buy”, PointRisk), indicating it would only apply to an entry with the same name. For years I have worked around this by separating all my systems into long and short versions.

    pps. It's May 19. The latest indication for a software update mentioned May 15. How's it coming?

    mur ang
    Advanced Member
    Advanced Member
    Posts:525

    --
    05-19-2010 09:13 AM
    See, the tradeplan runs after the session has processed, this makes close entry trades a problem. I am really not sure how to address this issue right now, it's complex and I don't want to create any other issues. The new version has alot of new features and I plan to be working on a rebalancing demo with it in the next week or so. I have now added the capablities of buy,sell , exitlong and exitshort from a tradeplan, which makes rebalancing much easier. Things are moving along, I trying to get the documentation for final edit in the next week or two and then address a few issues found during the test sweep with the software.
    Thomas Stridsman
    New Member
    New Member
    Posts:9

    --
    05-19-2010 09:33 AM
    So, in the new version, will the following be possible in a TradePlan
    ExitLong("RLA", "LA", GetCurrentSize("LA"), 0, [u]CloseExit[/u], Day)
    Buy("LA", 1, 0, [u]Market[/u], Day)

    Can original entry name be kept?
    Or do you need to work along these lines:
    n = n + 1
    Buy("LA" + n, 1, 0, Market, Day)
    If the latter, will the TradePlan accept names based on variables or only accept names within quotes?
    Does the Buy need to be a market order (since there were difficulties with the CloseEntry orders)?

    Thanks,
    T
    mur ang
    Advanced Member
    Advanced Member
    Posts:525

    --
    06-01-2010 11:50 PM
    You can use variables, and yes, you can't use entryclose or exitclose orders
    You are not authorized to post a reply.


     TradersStudio, Inc. ® Copyright 2004-2012 All Rights Reserved   Terms Of Use  Privacy Statement