After determining the purpose of your algo, you are ready to begin designing the algo. At a high level, your algo needs to choose an instrument to trade, submit a buy order to enter a position and submit a sell order to exit the position, as shown below.
To access the appropriate market data and ultimately submit orders, your algo needs to know which instrument you want to trade. For this algo, you choose the CME ZB Dec17 instrument.
After selecting the instrument to trade, you are ready to enter a position, as shown in this portion of the algo. To enter a position, the algo gets the current best bid price for the instrument and a quantity defined as 1 and uses this information to submit a 1-lot Buy limit order.
Once your Buy order is filled you want to exit your position, as shown in this portion of the algo. To exit your position, the algo retrieves the current ask price for the instrument and the fill quantity of the filled buy order and uses this information to submit a sell limit order.