Automating with Sterling Trader Pro

Discussion in 'Automated Trading' started by Scalper007, Jun 1, 2008.

  1. MGB

    MGB

    Anarcho,
    Can you look at their Excel basket example and figure out how they send orders from Excel?
     
    #21     Jun 1, 2008
  2. Yes thats true, they are giving me a rebate. But the rebate isn't free, i still have to do 400,000 shares a month to get that...
     
    #22     Jun 1, 2008
  3. Too funny! Looking at that basket example it looks like they use VBA to send orders through the API - from Excel. They sure don't document this anywhere (not that I'm surprised).

    So if you want to write some VBA code you could send orders in an automated manner from Excel. But it would be a pain in the ass and not nearly as powerful, flexible, or easy as using VB (which you also could link to Excel). In the end you have to learn some VB either way. Might as well learn the real thing rather than the "lite" version.
     
    #23     Jun 1, 2008
  4. anarcho

    anarcho

    Yes, the DDE support document also has an example to use. Here is a simple example, take this code and copy it into a excel visual basic module:


    Sub submitOrder()


    Dim order As STIOrder
    Set order = New STIOrder
    order.Account = "enter username here"
    order.Side = Range("a2").Value
    order.symbol = Range("b2").Value
    order.quantity = Range("c2").Value
    order.PriceType = ptSTILmt
    order.Tif = Range("d2").Value
    order.Destination = Range("e2").Value
    order.LmtPrice = Range("f2").Value


    order.submitOrder


    Set order = Nothing


    End Sub



    Then put the corresponding info the the spreadsheet. In A2 place the side (B,S or T), B2 symbol, C2 quantity, D2 put in D for day order, E2 pick an ECN, F2 you can place the DDE code for the bid/ask of the stock you choose in cell B2.

    Then insert a shape onto the spreadsheet and right click it. assign macro you just made in VB. Now all you gotta it click that shape and the order is sent.
     
    #24     Jun 1, 2008
  5. anarcho

    anarcho

    I understand that sending orders from excel may be the least efficient way to go about it but getting the math done for certain strategies is a breeze in excel. Having to then code that math into some crazy language, that I am no way proficient in, drives me mental. Also, if Sterling could get rid of T (short sale) that would be helpful.
     
    #25     Jun 1, 2008
  6. There's no mention of this example in the DDE guide under support documents, that looks like it came from the Excel Basket example. I'm looking at revision 3.3.10.1 dated October 2003 which I just downloaded from their website. Sure would be nice if they actually explained what they were doing in that block of code you pasted.

    Regardless, STIOrder is the ActiveX API command and you are proving my point. I can tell you a lot of ways to program an automated order submission in VB. I can't tell you straightforward way to do this using VBA within the confines of Excel. I admittedly am not that familiar with that and I'm sure there's a way. But I'm saying by the time you figure out how to do something useful with VBA in Excel, you'd have learned VB and written something far better. Either way you are learning and writing VB code.

    I have no desire to dig into a VBA solution, but if I were to try it, I'd try using a timer to check your condition and if the condition were met, call that send order routine. Don't forget to disable that condition after you send the first order. :eek:
     
    #26     Jun 1, 2008
  7. anarcho

    anarcho

    thanks for the timer suggestion. i'll give it a try and take a closer look an VB without excel.
     
    #27     Jun 1, 2008
  8. Quote from anarcho:

    I understand that sending orders from excel may be the least efficient way to go about it but getting the math done for certain strategies is a breeze in excel. Having to then code that math into some crazy language, that I am no way proficient in, drives me mental.

    You can (and I do) keep all the complex math within Excel and just reference your spreadsheet using whatever language you want. Excel allows you to do that.

    The order code you posted earlier is in VBA which is practically the same as VB. You need to understand that Excel isn't sending the orders, VBA is. All that excel is doing is providing a little button that you push when you want VBA to send your orders.
    Given the fact that you have to deal with a crazy programming language that you are in no way are proficient in, I don't understand why you're willing to mess with the shitty version (VBA), but not the useful version (VB).

    Also, if Sterling could get rid of T (short sale) that would be helpful.


    You can track positions with DDE and incorporate it into your logic on your excel sheet.

    Or you could track your position in VB through the API and know how to mark your orders quite easily. :cool:
     
    #28     Jun 1, 2008

  9. What an absolute cluster fuck today Sterling.

    What an freakn JOKE.
     
    #29     Jun 2, 2008
  10. Are you guys doing all of your own programming or do you have software that you use? I have no idea where to begin doing this. I want to start off by just writing a very simple system. For instance I could tell it to buy at a certain time and then put a stop and limit that cancel once either is filled. I have done some Tradestation programming, so I generally know how it works, but I'm at a loss as to how to do this. Where do I actually write the code and how do I tell it to start trading? Can I do this all in excel, or do I need to write it somewhere else? I have installed the DDE into excel and can track my positions doing that, but I don't know what else to do. Sterling's website is not much help. They have all this code, but I'm not figuring out how to actually write a complete trading system. Any help would be greatly appreciated.
     
    #30     Nov 3, 2008