Let’s Design – Part 1

As an Amazon Associate I earn from qualifying purchases.

2 Min Read

After figuring out the tools needed for development, the next thing you should start to consider is the design. This involves defining requirements for what you are trying to achieve. Without doing this step, it maybe difficult to know what to develop and where to start. This is not to say that these requirements are set in stone. Believe me, I have added many new requirements and removed a few throughout my first year of development. Here is an example of some of the requirements I came up with :

    • My application must has zero downtime.
    • My application must execute entries and exits accurately and in a timely manner.
    • My application must work with multiple strategies simultaneously.
    • My application must make designing and running strategies in a simplistic way.
    • My application must be able to manage my capital across different accounts and across different strategies.
    • Etc…

As mentioned before my trading platform is split into two parts: The trader and the web application. Let’s start designing the trader.

Below is a very simplified flowchart that roughly resembles how my trader operates:

The application is an infinite loop that checks for incoming data from the broker. Depending on the timeframe we are working with, the application will check at every relevant interval for data. E.g. If we are trading on the 5 minute chart then we would pull data in at every 5 minute interval ( xx:05, xx:10 etc.)

Once the data arrives from the broker, the trader will then start to analyze it and apply the strategies that I have defined. For each strategy, it will loop over the relevant data and then decide if any trades should be closed. If a trade has been closed between periods due to different exit requirements this will be logged and accounted for.

After positions have been closed, it will then start to look at what positions can be opened. There are a lot of decisions that need to be made in order to open a position. This can depend on factors such as:

    • How many trades were lost today?
    • Have I reached my maximum draw-down for this strategy?
    • Is the market about to close?
    • Is the current spread too high?
    • How many open trades do I currently have?

I hope this post has given you some insight into what an architecture for a trader might look like. In future blogs, I will be taking you through each component of the flow chart to better understand how they are actually coded. Please feel free to comment below with any questions you may have.

7 thoughts on “Let’s Design – Part 1”

  1. Avatar

    I think this will start my journey as a developer. I do competitive coding and can understand code but I haven’t worked on any project as such. I so want to thank you for this.

  2. Avatar

    Well this seem interesting.. can’t wait to see it through to the end . although I’m still new here..what are the resources you used to understand this?

Leave a Comment

Your email address will not be published.

Subscribe to my newsletter to keep up to date with my latest posts

Holler Box