order based on bar closes

Discussion in 'Trading Software' started by nicbizz, Nov 8, 2010.

  1. nicbizz



    Can anyone recommend a trading system that has the option (in the form of a toggle/button) that'll automatically place a limit order on the close of the current bar?

    For example, if I'm trading off the 1 min bar, and at the 32nd second, a signal is generated for me to buy at the close of bar no matter what happens, I can hit the button to have an order placed automatically instead of waiting for the bar to close, determine the price, and then manually key in the order.

  2. You can do this in tradelink by reading from an excel spreadsheet.

    tradelink is free and open source. It works with 12 brokers and data feeds.


    Here is code to give you an idea how to accomplish this :

    public class ClosingBarOrder : ResponseTemplate
       newbarevent(string sym, int interval)
            // ignore if we already sent for this symbol
            if (SYMBOLCOL[sym]) return;
            // grab latest value of excel column in case user changed it
    GenericTracker.CSVCOL2Generic<string>(EXCELFILE,ref BUYCLOSECOL,1);    
            // if column has an 'X', buy bar close
                  sendorder(new BuyLimitOrder(symbol,100,blt[symbol][-1].Close));
                // mark as sent
                SYMBOLCOL[sym] = true;
       override void GotTick(Tick k)
            // build bars from market data
       BarListTracker blt = new BarListTracker(BarInterval.FiveMin);
       const string EXCELFILE = "myfile.csv";
       GenericTracker<bool> SYMBOLCOL = new GenericTracker<bool>();
       GenericTracker<string> BUYCLOSECOL = new GenericTracker<string>();
       override void Reset()
             // handle bar events
             blt.NewBar+=new SymIdxDelegate(newbar_event);
             // read excel file
             GenericTracker.CSVInitGeneric<string>(EXCELFILE, ref SYMBOLCOL);
         GenericTracker.CSVCOL2Generic<string>(EXCELFILE,ref BUYCLOSECOL,1);    
            // request market data for all symbols in excel file