Automating with Sterling Trader Pro

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

  1. I haven't been able to get any automation working at all. I used the sample excel code earlier, but when I push the send button, nothing hapens. None of the samples from Sterling are working. I tried the Sterling Time Slicer, but I get an error message, "ActiveX API not enabled." I asked my broker to enable it, but I don't think it's enabled. Will this prevent me from doing any outside programming? Is there any way around it? Thanks for any help.
     
    #41     Nov 18, 2008
  2. MG6492

    MG6492

    I have been trading on Sterling for a while now and am seriously considering having my strategy's looked at to see if they can be processed to work with an API. Can anyone provide me with the basic steps I would need to get going with this process?
     
    #42     Nov 18, 2008
  3. I finally got my API enabled and have been trying to write some sort of strategy. I can get all of Sterling’s project examples to work, however getting my own code to work is quite difficult. I have spent the last 2 days just trying to figure out how to buy at the bid. If I’m having such difficulty just trying to do that, I’m wondering if this is even worth it. I’ve done some Tradestation programming, but this seems way out of my league. I’ve been thinking I should take a beginners VB class at my community college, but I’m not sure how much that would help me with specifically using the Sterling API.

    If someone could look at this code and tell me how I figure out how to buy at the bid. This is Sterling’s basket example of buying at the bid from the basket example. It doesn’t work when I copy it into my code. It either won’t verify, buys at the market, or buys at 0 (because it can’t come up with a price. The documentation says to use “B” for bid but no variation of it works. I don’t know what vStocks.ListItems(intOrderCount).SubItems(1) is. I tried copying the whole code and all of the object and variables, but nothing works. Any help is greatly appreciated.

    Dim order As STIOrder
    Set order = New STIOrder

    order.Side = "B"
    order.Symbol = "UYG"
    order.Quantity = "100"
    order.Account = "XXXXXX"
    order.Destination = "NSDQ"
    order.Tif = "D"
    order.PriceType = ptSTILmt
    order.LmtPrice = lvStocks.ListItems(intOrderCount).SubItems(1) ' Bid
     
    #43     Dec 17, 2008
  4. order.LmtPrice is a dataype of "double". This means you need to provide a number, ie an actual price.

    I STRONGLY encourage you to stop what you are doing, and take a couple weeks to at least learn the basics of the language you are coding in. One error will cost you thousands of dollars and then you'll wish you had done this in the first place.

    I know a guy who is not a beginner who dropped over 500K on a coding error last month.

    This is not stuff you should take lightly. You are playing with fire right now.
     
    #44     Dec 17, 2008
  5. Thanks for the concern, Shreddog, but I’m one step ahead of you. I quickly realized that testing this on the live account wasn’t going to work. I called Sterling and got a demo account set up. They said it expires after 2 weeks, but I could just email them and they would extend it again. Unfortunately the demo account is not real at all. All orders are instantly filled regardless of where they are. It will work fine though. I think the server stop orders are not filled until the stop hits (although it gives really weird execution prices), so practicing cancelling orders and other things can be done that way.

    Yes I noticed that when I put “order.LmtPrice = 5.00” it executes fine at 5.00. So if a number is required, what is “order.LmtPrice = lvStocks.ListItems(intOrderCount).SubItems(1) ' Bid” ? I am assuming that they are referencing something, but I can’t find what. Sterling gives no examples of using limit orders, this was taken from the basket example code.
     
    #45     Dec 18, 2008
  6. I have no idea, it might be something specific to the basket trader itself, which I've never used. I haven't seen the example you are referring to either. But really, you should at least understand what the different datatypes are in VB. Your question would have had an obvious answer if you understood this, and this is extremely basic. I mean like "Day 1" basic.

    So what are you going to do after things work on the demo platform? You still will have lots of coding to do in the future and you still won't have the basics to fall back on. How will you progress from those very very limited examples Sterling provides? IMO you don't even know enough to ask the right questions on this thread.

    I should also mention another friend that took down all of his firm's execution servers for half a day with a coding error. This happened last week. It was a 5 figure error. He also is an experienced coder. I'd put a good deal of the blame on the firm for having such a fragile environment, but still, things get out of control very quickly when automated. I also had a 66K error a couple years ago that wasn't due to a coding error, but could have been caught with better error checking in my code.

    You aren't using Easylanguage or some other broker specific language. There is no safety net with these languages.

    I don't mean to rag on you, but I think I'm doing you an honest favor by encouraging you to step back and learn at least the basics. 2 weeks of intensive study with a "Learn VB" book will at least teach you enough to ask the right questions and maybe help you better understand the risks you are taking.
     
    #46     Dec 18, 2008
  7. bespoke

    bespoke

    I agree with shreddog. I lost half my account in 1 minute when I wrote my first ATS with sterling. Wasn't really that much but it sure was then and it set me back a few months on the learning curve. And I've been coding for 10+ years (though not professionally). It was because I rushed it and was too excited to run it. Didn't put in all the proper fail-safes and I sent out too many orders. I forgot to comment out one line of code that I had put there during demo. One of sterlings "quirks" began looping and you know the rest of the story....

    I've written A LOT of programs for myself and others and even this morning when I ran a new bot I wrote last week I had some kind of problem (don't know what it is yet) and it cost me a lot. Program froze, then sterling froze. Had 40 fills out there which were supposed to be closed seconds after entry...

    So for your own sake, you should learn the language before you even think about trying to automate. Good luck.
     
    #47     Dec 18, 2008
  8. Gee, are you having a bad week or something? I just asked a question. Maybe I should just give up because there’s a chance I could loose money. I know this is basic stuff. How am I supposed to learn unless I ask stupid questions? If you don’t want to help, just say so. Like I said I spent 2 days trying to figure it out. Call me an idiot, but at least I’m trying. I know VB isn’t EasyLanguage, but I think they are all sort of similar. I mean you can look at the code and kind of figure out what it’s trying to do. I know this is risky stuff. I’m not going to leave the computer or anything. My ultimate safety net is my prop firm that will automatically exit all positions if my loss for the day hits $500.

    The basket example is downloaded from the Sterling site. Click on examples and then AX examples, then VB6 examples, and then basket example. Open the code and read it for the “buy bid” button. It says “order.LmtPrice = lvStocks.ListItems(intOrderCount).SubItems(1) ' Bid”

    OK so I’ll go to the library today and get a VB for beginners book. The last one I got was 3 inches thick. I didn’t really get a chance to read it. I just figured I could learn better by looking at the sample code and trying to figure out what it was doing and then change it to what I want it to do. I just thought for $235 a month there would be a little more support. I looked at my community college’s schedule last night. It looks like to take the VB class, you have to first take a standard computer class.
     
    #48     Dec 18, 2008
  9. So if a guy standing next to an open can of gasoline asks YOU for help learning to light matches would you just help him or warn him he's standing next to gasoline? What if he didn't seem to fully understand how flammable gasoline is? Would you repeat your warning?

    Sterling has ZERO support for the API. You are truly on your own and it's got a few gotchas.

    And btw, none of the losses I mentioned earlier involved anyone stepping away from their computer. We were all right in front of our machines and these 5 or 6 figure losses happened in SECONDS. And I can assure you that in my case I was way over my allowed buying power for the day. Those limits at my firm did not in anyway contain my losses.

    2 of us have now given you valuable advice learned from the school of hard knocks. If you'd rather pay your own tuition for these lessons, that is your choice.
     
    #49     Dec 18, 2008
  10. bespoke

    bespoke

    I went 20x over my daily (electronic to boot) loss limit that day.

    It's not that shreddog doesn't want help with sterling. He just recommends you learn the language first. And learning by looking at example code is not the best way. You need to know the fundamentals.

    Since there isn't much api support, a group of us have been helping each other out on this site. Here's one of those threads http://www.elitetrader.com/vb/showthread.php?s=&threadid=125715&perpage=40&pagenumber=1
     
    #50     Dec 18, 2008