need help with Tradestation code

Discussion in 'Automated Trading' started by in56, May 4, 2007.

  1. in56

    in56

    I'm hoping somebody can help me with coding simple strategy in Tradestation:

    MACD histogram (12, 26 and 9 based on close prices) that gives signals when changes direction. I want to go long when the histogram has been going down and turns up, and short when the histogram has been going up and turns down. And only 1 trade pre day.

    Also, can I code n Tradestation position sizing? I would like to use 1% as a stop and 1% as a target/exit and calculate amount of shares based on $100 potential loss. For example, if MACD gives me entry signal at $50, then stop would be at $49.50 and target at $50.50. And I need to buy 200 shares. Time frame is 5 min.

    I would really appreciate if somebody can help me to automate my strategy in Tradestation.

    Tank you in advance.
     
  2. Tums

    Tums

  3. Chabah

    Chabah

    The strategy you describe sounds OK. I think when you actually code it you may realize there are a couple factors that need to be described.

    I have an automated EasyLanguage strategy that does something similar to what you are describing, although I use price trends and not MACD. The position sizing is pretty simple. I have one function called ChabahEquity that returns the number I use for account equity (currently $7500 per trade). I have an input into the strategy that is the RiskPercent (1%). In my strategy I figure out the current price and the stop, which gives a RiskPerShare. What I then do is take ChabahEquity * RiskPercent and then divide that by RiskPerShare. That gives you a number, which you can then round to the nearest 5 or 10 or whatever shares.

    Anyway it's not that difficult but if you don't know how to code and you can't learn then there are lots of services who can do it for you. I think most charge around $75 per hour or so, although I have never hired one. Don't expect anything for free - you get what you pay for.

    Chabah

    PS If you want to know lots more about my system, I have a thread in here called Chabah on Automated Trading.