 ### Visual Strategy Development [Visual strategy creation](https://hackernoon.com/tagged/visual-strategy-creation) is an important part of quick and efficient development, as it allows you to easily debug and adjust ideas by looking at how signals develop and change with shifts in the market. I find Python to be a good language for this type of data-science, as the syntax is easy to understand and there are a wide range of tools and libraries to help you in your development. On top of this, the [Alpaca Python API](https://github.com/alpacahq/alpaca-trade-api-python) gives us an easy way to integrate market data without having to implement a new [API](https://hackernoon.com/tagged/api) wrapper\*. **_\*Disclaimer: As of today (July 27th 2018),_** [**_Alpaca Trading API_**](https://docs.alpaca.markets/) **_can be used only by invited beta users who opened accounts with Alpaca Securities._** [**alpacahq/alpaca-trade-api-python** _alpaca-trade-api-python - Python client for Alpaca's trade API_github.com](https://github.com/alpacahq/alpaca-trade-api-python "https://github.com/alpacahq/alpaca-trade-api-python")[](https://github.com/alpacahq/alpaca-trade-api-python) For data processing and plotting, I recommend using [TA-Lib](https://mrjbq7.github.io/ta-lib/) and [Matplotlib](https://matplotlib.org/). Ta-Lib provides a nice library to calculate common market indicators, so that you don’t have to reimplement them yourself; while matplotlib is a simple yet powerful plotting tool which will serve you well for all types of data visualization. Here’s a code snippet of an example framework script I put together (full scripts at the end of this section).  (Code Snippet of an example trade visualizer script I put together— full script at end of this section) The script adds a simple moving average cross strategy against a few different trading symbols to give a small sample of the how it might fair in live trading. This allows for a first sanity check for a new strategy’s signals. Once a strategy has passed visual inspection you can run it through a backtesting tool, such as the one discussed in the “[Algo Trading for Dummies](https://hackernoon.com/algo-trading-for-dummies-building-a-custom-back-tester-part-3-1cc1318987e3)” series. [**Algo Trading for Dummies — Building a Custom Back-tester (Part 3)** _Custom Back-testing and Order Handling_hackernoon.com](https://hackernoon.com/algo-trading-for-dummies-building-a-custom-back-tester-part-3-1cc1318987e3 "https://hackernoon.com/algo-trading-for-dummies-building-a-custom-back-tester-part-3-1cc1318987e3")[](https://hackernoon.com/algo-trading-for-dummies-building-a-custom-back-tester-part-3-1cc1318987e3) You may even wish to add visual markers to each simulated trade and, for a move advanced strategy, the indicators the signal was derived from. This can make it even easier to analyze the weaknesses of a signal set so that you can adjust its parameters.  ### Simple Trading Bot Once you’ve moved past the backtesting stage, you’ll need a simple trading framework to integrate your strategies for live testing. This can then be run on a paper trading account to test the signals against a live data feed. This is an important step in development, as it tests whether the strategy has been over-fit to its dataset. For example, a strategy could easily be tuned to perfectly trade a specific symbol over a backtesting period. However, this is unlikely to generalize well to other markets or different time periods — leading to ineffective signals and losses. As such, you’ll want to a simple way to test your strategies in a staging environment, before committing any money to them with a real trading account. This is both for testing the strategy and the implementation, as a small bug in your code could be enough to wipe out an account, if left unchecked. Here’s another example snippet of a trading bot which implements the moving average cross strategy (full script at end of this section).  (Code Snippet of a trading bot which implements the moving average cross strategy — full script at end of this section) To make this into a full trading bot you could choose to either add a timed loop to the code itself or have the whole script run on a periodic schedule. The latter is often a better choice, as an exception causing an unexpected crash would completely stop the trading bot if it were a self contained loop. Where as, a scheduled task would have no such issue, as each polling step is a separate instance of the script. On top of this, you’ll probably want to implement a logging system, so that you can easily monitor the bot and identify any bugs as it runs. This could be achieved by adding a function to write a text file with any relevant information at the end of each process. Once you have a working strategy, the Alpaca API should make it easy to expand your trading bot into a full production system, allowing you to start trading quickly.  _By Matthew Tweed_ [](https://medium.com/automation-generation) #### Please follow [Alpaca](https://medium.com/@alpacahq) and [Automation Generation](https://medium.com/automation-generation) for fresh posts on Financial Market, Algorithmic Trading, Technology. #### You can find us [@AlpacaHQ](https://twitter.com/AlpacaHQ), if you use twitter. [](https://medium.com/automation-generation) If you’re a hacker and can create something cool that works in the financial market, **please check out our project “**[**Commission Free Stock Trading API**](https://alpaca.markets/?utm_source=medium&utm_medium=blog&utm_campaign=strategy_list&utm_content=part1)**” where we provide simple REST Trading API and real-time market data for free.** Brokerage services are provided by Alpaca Securities LLC ([alpaca.markets](https://alpaca.markets/?utm_source=medium&utm_medium=blog&utm_campaign=strategy_list&utm_content=part1)), member FINRA/SIPC. Alpaca Securities LLC is a wholly-owned subsidiary of AlpacaDB, Inc.