how to create this simple program?

Discussion in 'Automated Trading' started by condythug, Jan 3, 2012.

  1. condythug


    i am a novice at using automated programs; i am wondering how i can write a simple program to close off my positions at the end of the day when i won't be around the computer. for example, i enter the trades manually in the morning and then set a stop loss, and then come back to cancel all untriggered stop loss orders and then close off all positions (using market on close order).

    i do this manually now but how can i write a simple program to automatically cancel all my untriggered stop loss orders at say 3:45pm and then automatically put in market on close orders for the remaining open positions?

    thks for any advice...
  2. That's easy in Pascal.

  3. condythug


    how do i get around to start using pascal?..

  4. Worst ET post of all time?
  5. Bob111


    it's not going to be easy,because it's not as simple,as you may think. for example-internet\broker disconnection. you must have procedure to handle such event. cause sooner than later you are going to run into it. conformations for submitted orders,rejections,etc-it's all needs to be properly handled.maybe smart phone\tablet and\or something like IB's webtrader would be a better solution for a person,who don't know the programming at all?
  6. "A simple program" could arguably be achieved by creating a macro that would control mouse movements over your ladder/order entry screen and clicking the "flatten" button. This would probably be the easiest option if you know nothing about programming as I'm sure there are downloadable tools online that will let you record mouse/keyboard macros. You would just have to anticipate any windows or screen disruptions that would break macro.

    If you really wish to create a simple application to handle what you're talking about, it really depends on your trading platform and how low level you're willing to go. From the sounds of it, if you're willing to put in the effort, you'd have to familiarize yourself with your platform's API and work around that (and that could take quite a while).
  7. Depending on your broker and the instrument you are trading, you might be able to do what you want with "Good-Until" or "Good After" orders (I'm using IB as an example). This allows you to keep the orders on the broker side, which will remove the need to deal with internet/CPU problems on your end. As mentioned, the code logic is simple, but the extra glue to make things bulletproof is much more work.
  8. What could possibly go wrong?
  9. Thanks :D

    Ninjatrader already does this, but I have no clue what
    His platform is.
  10. This. This was a helpful post.
    #10     Jan 3, 2012