Creating a trading system from scratch

How many lines of code you are comfortable with


  • Total voters
    61

UberMachine

Well-Known Member
#1
This is thread on how to create an automated trading system from scratch (from absolutely scratch).
From conceiving an idea to implementing it, getting feedback and improving it and even creating your own data sources (everything open source)
This would be one big heck of a ride and you need to spend some time hands on (I expect it would take me 45 days to complete this)
This assumes no prior knowledge whatsover about programming or even technical analysis but you must have some basic finance fundamentals.
I am going to use a pipeline based approach of selecting stocks. So I am not going to select any predefined stocks just a stock universe

To begin with, this is the system to be implemented before improving it
  1. Select NIFTY 50 stocks
  2. Place orders at the beginning of the day (short the top 5 returns the previous day)
  3. Keep a standard stop loss, say 3% and a standard SELL price percentage
  4. Close positions by the end of the day
  5. All orders ae intra-day cash orders
Details
  1. Capital = 20000
  2. Leverage = 5
  3. Returns expected = 5 to 10% in 1 month (for 5X Leverage; mean return = 5%)
  4. Max drawdown = 5% * multiplied by leverage = 25%
  5. Python Anaconda installed
  6. Zerodha broker
Why zerodha?
Because I use them and they have better automation tools to execute orders fast.

And everything is to be open source,; no paid data, no fancy indicators, no complex machine learning, nothing.
Just plain logic and a willingness to learn and some greatness to accept defeat and move on.

Warning
  1. The original system above would result in a loss after adjusting for other expenses; the mean return is on the improved system (that would be implemented by the end)
  2. For newbies, don't get stuck by the simplicity. Its too tempting to leverage up but keep the max leverage at 5. You can enter into live trades also (but beware your max loss is only 5000)
Before beginning, just complete the following threads

Python installation
Python primer for trading


and definitely vote the above poll
 
Last edited:

UberMachine

Well-Known Member
#3
Yes.
This will work in Nest trader upto to order placement.
Actually, it could work with any broker and any platform but the order execution part (the final step) should be taken care of.
As mentioned, I prefer zerodha since I use it.
If most people use NEST trader, I could use the basket order facility to place all orders in one go.
 
#4
Yes.
This will work in Nest trader upto to order placement.
Actually, it could work with any broker and any platform but the order execution part (the final step) should be taken care of.
As mentioned, I prefer zerodha since I use it.
If most people use NEST trader, I could use the basket order facility to place all orders in one go.
A lot of people use Nest trader. I use Kite for charts, but trade through Nest for better integrity.
 

UberMachine

Well-Known Member
#5
My Approach

I am going to scan a list of stocks for some condition and place orders on a daily basis. This is something similar to screeners we all use.
I would be also using my own library extensively for this product (don't worry its open source)
You could read more about my approach to day trading here.

I prefer rules-based trading, trading system defined by rigorous rules. In fact, this is algorithmic trading in the purest sense. Using machines is just to automate them. I would also be using resources from Quantopian. And I am also biased against technical analysis. I don't think technical analysis could provide you more information than what actually is to make substantial profits (May run a separate experiment on it).

I believe even a well defined system such as the one above would produce drastically different results based on a lot of other factors, which is the main reason for algorithmic systems to fail. I would also use this opportunity to experiment this belief. The main reason for doing this is to see how we backtest, measure performance and implement feeback into our system.

Disclaimer
I am creating my own backtesting product for commerical use and also a blog (so I would also draw much of the code from it which is certainly open source). Your feedback here may be used to improve it.
 
#8
Fine then. I think there is a basket order functionality in NEST trader (I used it 3 years back; so it must be there)
Ok. I personally have never used basket order feature, but will try. For EQ, I do use multiple orders e.g. 5 orders to buy BoB between 146.5-147, qnty 50 each, something like that.
 

VJAY

Well-Known Member
#9
Dear UB,
Thanks for sharing your valuable knowledge of coding automated trading with us ...Its a really great gesture and many small retailers like me learn which we thought only biggies can do....Thanks a lot...
 

Similar threads