Building a profitable trader bot step-by-step

Congratulations! You have just committed yourself to one of the most challenging exercises today. Algorithmic trading is a fascinating world. Its learning will allow you to push the boundaries of technical analysis and trading.

I wrote this book to help you design your trading system using Prorealtime

As a first step, I will provide you with the theoretical and conceptual basis you need to develop trading algorithms. Then, step-by-step, I will lead you in programming your trading bot. After that, a chapter about the backtest analysis will explain how to reduce the risk of overfitting.

I created a machine learning model specially adapted to optimize automated trading systems, which you can easily use to configure your trader robot.

After running on a real account, you will have to manage your automated trading systems. There are some management rules that you need to know and strictly apply. These rules will tell you when to start and stop a trading system.

BONUS: Get the source code of a complete trading strategy!


Original price was: €49,00.Current price is: €39,00.

Categories: ,
(11 customer reviews)


Second Edition

The present book is a complete revision of the previous version representing a real improvement for the reader. Most of the chapters have been rewritten, and many new thematics have been appended:

  • – Correlations between technical indicators
  • – Combinatorial and arrangement
  • – Chap recognition using Euclidian distance
  • – Multi-timeframes fractal correlation
  • – Voluntary under-optimization model
  • – Over-optimized strategy arbitrage
  • + Source code of an automated trading strategy
  • + Source code to recognize a Double Bottom


This book is calling to become a must-have reference work for anyone interested in trading system development using Prorealtime.


Date of publication 2022/04/28
Editor Self-publishing
Number of pages 638


What about the news?


1. How to choose the best technical indicator?

Using uncorrelated indicators improves market reading and decision-making. I provide you with a code calculating the correlation between two technical indicators. That will help you better choose your indicators for manual trading as automated trading.


2. Find the best moving average crossing

Thanks to an algorithm built on the arrangements without repetition, you will find the most profitable moving average crossing. The source code is easy to use and can be applied to any trend indicator.


3. Chartist figure recognition

I completely rewrote this chapter. I provide you with three algorithms capable of recognizing any chartist figures, from the simplest to the most complex. The first algorithm works with correlation, the second with Euclidian distances, and the third with Hausdorff distance. Mathematic distances are particularly efficient with chap recognition. The source codes are detailed and explained. You simply have to put your preferred figure in the dataset to create your chartist indicator.


4. Multi-timeframe fractal arbitrage

In this new chapter, I introduce an arbitrage algorithm between two timeframes. It calls multi-timeframe fractal correlations to anticipate a bullish reversal. This strategy works on most of the main indexes, such as the S&P500, the Dow Jones, or the DAX 40.


5. The under-optimized model

This model is straightforward to understand and use. It consists of voluntary degrading the performance of a backtest to increase the probability of future gains.


6. Overfitted strategy arbitrage

It is the opposite of the previous model. An over-optimized strategy has more chance of losing in the future than winning. This model tries to turn the risk of loss into an expected gain. It consists of voluntarily over-optimizing a strategy to open reversal entry in the future. However, you will need to respect some rules to apply this model.


Table of Contents



  • What is algorithmic trading?
  • Why have I chosen to create trading systems?
    • What is the style of trading that I have chosen?
    • An example of automated building entries
  • Automated trading expectations
  • Limitations and possibilities of automatic trading
    • Differences between automatic and autonomous systems
    • Unadaptability of automatic systems
      • The problem of the unadaptability to the environment
      • How to resolve the automated system’s unadaptability?
    • The extreme “complexity versus simplicity”
      • The management rules
      • The global context
      • The decision-making variables
  • Why Prorealtime?
    • The programming language of Prorealtime
      • Properties of the programming language
    • ProOrder Autotrading functioning
    • On which assets can I launch a bot?


Handling the Prorealtime platform

  • Overview of the development environment
    • Development and test environment
    • Backtest result
    • Execution following environment
      • ProOrder Autotrading window
      • Opening entries window
  • Create and launch the first test
    • Create a ProOrder system
      • Probacktest and Automated Trading
      • Probacktest & Automated trading editor
      • Create by programming
    • Explanation of example code lines
      • First bloc
      • Second bloc


The great concepts of algorithmic trading

  • The three pillars of automatic trading
    • Efficiency
      • Definition
      • Loss of efficiency
      • Maintain the efficiency of a system
      • Concept of software engineering
    • Effectiveness
      • Definition of the effectiveness
      • Complexity
      • Classes of complexities
      • Reduction of dimensionality
      • Reduce the dimensionality thanks to the booleans
      • The principal component analysis
      • Conclusion about the dimensionality reducing
      • Reduction of the granularity
      • The Monté-Carlo algorithm
      • Alpha-Beta pruning
      • Effectiveness and complexity – For further
      • The “ideal” number of technical indicators
      • Effectiveness and complexity synthesis
    • Performance
      • What is the Performance?
      • Involve the risk with the performance
      • Sharpe ratio
      • Be careful with the latent volatility
      • Conclusion
  • Risk management and integration
    • Risks related to the automated trading system
    • Exposure to the financial risk
      • Financial Risk integration
      • Example of risk integration
  • Trading and Gambling
    • The heads or tails game
      • Heads or tails game without fees
      • The heads or tails game with fees
    • The roulette gamble
      • Roulette gamble without the green color
      • The Martingale roulette gamble with the green color
    • Conclusions Trading and Gambling
      • The transaction cost
      • The risk of a transaction
      • The spread/expected gain ratio
  • Strategy versus Tactic
    • Definitions of strategy and tactic
      • What is a strategy?
      • What is a tactic?
    • Strategical approach
      • Arbitrage opportunity
      • Big guys versus little traders
      • The actions of algorithms and robots
      • The target prices
      • The trading strategy cycles
      • Conclusions about the strategical approach
    • Tactical approach
      • Zero-sum games
      • Von Neumann Minimax theorem
      • MiniMax Algorithm
      • Is trading a zero-sum game?
      • Why the tactical approach?
      • Should the strategy approach be rejected?
      • Tactic and strategy meshing
    • Your two first tactical choices
      • Choice of your broker
      • Thin market versus thick market
  • The five activities of algorithmic trading
    • Automated strategy researches
    • Automated systems design
    • Development and unitary tests
    • Backtest and validation
    • Automated system management


I. Automated strategy research

  • Decision tree
    • Find an entry point
      • Decision tree modelization
      • Complete code of the research system
      • Test running
      • Short strategy version
      • Source code for a short strategy with three indicators
      • Running and interpretation of the result
  • Combinatorial and arrangement
    • Try all the crossing combinations
    • Arrangements without repetition
      • What is an arrangement?
    • Find the best moving averages crossings
      • Source code to find the best crossing
  • Chartist figures recognition
    • Recognition by correlation
      • The steps of recognition by correlation
      • Double bottom indicator source code
      • Double bottom detection example
      • Open a long entry after a double bottom
      • Source code of the double bottom algorithm
      • The limitation of the recognition by correlation
    • The Euclidian Distances
      • A few words on Euclid
      • What is the Euclidian distance?
      • Chap recognition using Euclidian distance
      • Source code of the green hammer recognition
      • Majority vote principle
      • Generalization of the recognition algorithm
      • Double bottom recognition using distances
      • Source code of the double bottom recognition
      • The limitation of the Euclidian distances
    • The Hausdorff distance
      • A few words on Hausdorff
      • What is the Hausdorff distance?
      • Hausdorff distance formula
      • Sequences of the Hausdorff algorithm
      • Source code of the Hausdorff distance recognition
    • Conclusions about chartist figure recognition
  • Multi-timeframes fractal correlation
    • What is a fractal?
    • The fractal on the market
    • How to exploit fractals on the market?
      • Calculate the correlation between two timeframes
      • Source code to calculate a multi-timeframe correlation
      • Source code of a multi-timeframe fractal arbitrage
      • Conclusion about fractal arbitrage
  • Push the boundaries of the strategies research


II. Automated trading system conception

  • Creation cycle of an automated trading system
    • The conception cycle
    • Model of conception
      • The Cascade model
      • The V cycle model
  • General conception
    • Description of the strategy
      • Decisional description
      • Functional description
      • Management rules description
    • Example of a general conception
  • Detailed conception
    • Pseudo-code example


III. Development of an automated trading system

  • Integrate the transaction cost
    • DAX spread table
    • IG Market spread
  • Global architecture of the robot
    • “Parameters and initialization” Block
    • “Entries opening” Block
    • “Opened entries management” Block
    • “Emergency stop” Block
  • Parameters and initialization of the variables
    • Definition of the parameters
      • Management of the time frame
      • Choice of the time frame
      • Multi timeframe
      • Rebuild a superior time frame
      • The tick-by-tick mode
      • Tick-by-tick mode and reliability of a backtest
    • Perception and vision of the market
      • Human perception
      • Market perception by a system
    • Define an economic and market calendar
      • Market trading hours
      • Market trading days
      • Vacancy and closed market days
      • Particular days
      • Saturday and Sunday cases
      • Create a “calendar condition”
      • Central bank days
    • Limit the number of openings by day
      • Source code to limit the number of openings by a day
      • The ideal number of entries by day
    • Initialization and reinitialization of the variables
      • Undefined initialization
  • The types of markets
    • Identify the type of the market
      • The six types of markets
      • End of the trend and acceleration
      • Choose a type of market
    • Measure the market trend
      • Trend indicator slope
      • Moving average
      • Linear regression
      • Linear regression versus Moving average
      • Quadratic regression
      • Smoothing – lag adjustment of the technical indicators
      • The three technical configurations generating errors
      • Eliminate the false signals thanks to the smoothing
      • The Smoothing/lag ratio
      • Avoid the false signals using the standard-deviations
    • Reflexion on the linear and polynomial regressions
      • Example of bullish trend market detection
      • Interpretation of the result
    • Measurement of the market volatility
      • Measurement of the historical volatility
      • Implicit volatility
    • Market characteristics of the raw materials
      • Supply and demand balance
      • The seasonality
      • The storage capacities
      • Conclusions of raw materials
    • Measure the acceleration of the market
      • Measuring price direction
      • Measuring price acceleration
      • Measure the acceleration of other indicators
  • Open an entry
    • Configure the stop-loss and the target
      • Static positioning of the stop-loss and the target
      • Dynamic setting of the stop-loss and the target
      • The Grid algorithms
      • Algorithm of stop-loss range adjustment
      • My choice about stoploss and target positioning
    • Opening entry instructions
      • Structure of the opening entry instruction
      • Open a long or short entry
      • Number of contracts by order
      • The types of entry opening orders
      • Trigger range orders
      • The validity period of the LIMIT and STOP orders
      • The time between two entries
    • Entry status of your trading system
      • How to use the entry state variables?
    • Entry opening conditions
      • Market conditions
      • Conditions of your trading strategy
  • Manage an opened entry
    • Stop-loss and target initialization
      • The four types of stop-losses
      • The four types of targets
      • Example of stop-loss and target positioning
    • Stoploss and target management
      • Modification of the stop-loss and the target
      • Inactivation of stop-loss and target
      • Trailing stop-loss
    • Program a trailing stop-loss
      • The two types of trailing stop-loss
      • Trailing stop algorithm
    • Reinitialization of the variables
      • Loss of efficiency risk
      • Unexpected entry opening risk
      • Create a reset block
    • Target overwriting
      • Chose a moving average as a target
    • Algorithm of the Hundreds
      • The indicator of the hundreds
      • Algorithm of the rounded price detection
      • Choose the hundred as a target
    • Monthly pivot
      • Calculation method of the pivot
      • Monthly FIBONACCI pivots
    • Profit securing algorithm
      • Needed variables for the profit securing algorithm
      • Management and adjustment of the STOP order
    • Replace the target with a stop order
      • The target order weakness
      • Profit securing conditions
      • Algorithm of the conditional stop selling activation
      • Enrich the algorithm of the stop selling order activation
  • Emergency stop of a trading system
    • The QUIT instruction
      • Warning on the QUIT instruction
      • Example of a QUIT instruction
    • When to stop a trading system?
      • Stop due to excessive volatility
      • Stop due to breakout of support
      • Stop due to excessive losses


IV. Analysis of the backtests

  • Launch a backtest on Prorealtime
  • Reading of a backtest result
    • The analysis metrics of a backtest
      • Gains and losses
      • Distribution of the trades
      • Times
      • Advanced widgets
  • Measure the efficiency of a trading system
  • Identify the common denominator
  • Is your trading system over-optimized?
    • The two main risks of over-optimization
      • Example of over-optimization by an excessive precision
      • Example of over-optimization by generalization error
    • Global standard-deviation of your strategy
      • Too large standard deviation
      • Acceptable standard deviation
    • Earnings distribution
      • Too concentrated earnings distribution
      • Dispersed earnings distribution
    • The measure of Tracking Error
      • Tracking error of a strategy
      • How to interpret the tracking error?
    • The profit/loss ratio
      • Too low profit/loss ratio
      • Consequences of a too low profit/loss ratio
    • Profit securing
    • Time in the market
      • The standard deviation of time in the market
      • The time in the market increasing
    • Duration of latent loss
    • The first visual controls summary
  • The stress-tests
    • Spread increase
      • How to conduct this stress test?
      • Simulation of spread increasing
      • Simulation running with Python
      • Simulation of spread increasing on Probacktest
      • Over-fitted strategy behavior
      • Under-fitted strategy behavior
      • Summary of spread increasing simulations and tests
    • Trigger stop loss by a single point
      • Why do this test?
      • Method of the test
      • Generalization of this methodology
      • Trigger stop-loss summary
    • Simulate the back to heads or tails
      • Asymmetrical strategy example
      • Back to heads or tails of an asymmetrical strategy
      • The example of the symmetrical strategy
      • Back to heads or tails of a symmetrical strategy
      • Make your simulations thanks to Python
      • Conclusion about back to heads or tails test
    • Series of losses and worst possible case
      • Estimate the series of losses cost
      • Worst possible case simulation
    • Flash crack simulation
      • EUR/CHF Flash crack of 2015/01/15
      • Stress-tests summary
  • Optimization of the variables
    • Optimizer of the variable functioning
    • Launch the optimizer of the variables
      • Open the window of the optimizer
      • Optimizer window
    • Optimize a variable
      • Add a variable to the optimizer
      • Configure the interval and the step
      • Run the optimizer
      • Reading the result of the optimizer
      • Optimization of the variables and tick-by-tick mode
      • Sort the result of the optimizer
      • Deeping the interval of values
    • The orphan values
      • How to know if a value is an orphan?
    • Orphan values conclusion
  • The Gradient Descent algorithm
    • Concepts and definitions
      • Definition of the Gradient-Descent algorithm
      • Convex and non-convex functions
      • Mean Squared Error
      • Cost function
      • The Cost of error
      • Local and global minimum
      • Local and global maximum
    • Why use the Gradient-Descent algorithm?
    • How to use the Gradient Descent algorithm?
      • Gains evolution
      • The gain curve
      • Concave adjustment of the result using Excel
      • Create a chart thanks to Excel
      • Localize the global maximum
      • Choose a value
    • The limits of the Gradient Descent algorithm
      • The displacement of the minimums and the maximums
    • Gradient Descent Summary
  • Walk-Forward Optimization
    • Concepts and definitions
      • What about the Walk-Forward Optimization?
      • Temporal series
      • Training set
      • Validation set
      • Walk-Forward Efficiency
    • Run a Walk-Forward Optimization
    • Activate the Walk-Forward
      • First Walk-Forward optimization result
      • First interpretation of the result
      • Second Walk-Forward optimization
      • Second Walk-Forward optimization result
      • Second interpretation of the result
      • Unique event cancellation
      • Third interpretation of the result
    • Interpretation of the Walk-Forward optimization result
    • The limits of the Walk-Forward optimization
    • Walk-Forward optimization Summary
  • Stochastic modeling
    • Concepts and definitions
      • Definition of the stochastic test
      • Purpose of the stochastic test
    • Application of the test on Prorealtime
      • How to process stochastic modeling on Prorealtime?
      • Validation requirements of the test
      • What are we trying to find?
    • Unitary test of stochastic modeling
      • Initial problematic
      • Mini trend-following strategy example
      • The unitary stochastic modeling goal
      • Unitary test running
      • Interpretation of the result
    • Global Stochastic modeling test
      • Global Stochastic modeling test goal
      • Global test running
      • Result interpretation
      • Result of the global stochastic modeling test
    • Generalization of the stochastic modeling
    • The limitations of the stochastic modeling
    • Conclusion about the stochastic modeling
  • GD-SM Optimization model
    • Presentation of the GD-SM model
      • Definition of the GD-SM optimization
      • Why use the GD-SM optimization?
      • Application of the classical model to the financial market
    • Functioning of the GD-SM modeling
      • Selection of the possible values
      • Validation of possible values
    • The limits of the GD-SM
    • Summary of the GD-SM optimization
  • Voluntary under-optimization model
    • Example of an automated trading strategy
      • Description of the trading strategy
      • Source code of the entry openings
    • Optimization sequence
      • Test period division
    • Stop-loss and target optimization
      • Optimization of the stop-loss
      • Result of the stop-loss optimization
    • Optimization of the target
      • Target optimization preparation
      • Result of the target optimization
    • Overfitted configuration of the strategy
      • Result of the overfitted backtest
      • Backtest and reality comparison
    • Find the fair optimization of a trading system?
      • Deteriorate the equity curve of the backtest
      • Under-optimize the stop-loss and the target
      • Result of the under-optimized backtest
      • Validation of the optimization in the future
    • The limitations of the under-optimization model
      • Risk management accordance
      • Definition of an “under-optimized” value
      • What parameters need to be under-optimized?
    • Voluntary under-optimization summary
  • Over-optimized strategy arbitrage
    • What is an over-optimized strategy arbitrage?
    • How to over-optimize a strategy?
      • Arbitrage result
      • Interpretation of the result
    • Model of over-optimized strategy arbitrage
  • Entry opening after the entry point
    • Entry opening delayed
      • Add a delay before the opening
      • Add a time condition
    • Example of strategy with delayed entries
      • Source code of a delayed trend following strategy
      • Optimizer of the variable running
      • Interpretation of the result
  • Build a position in the market
    • Why build a position?
      • Risk smoothing
      • Countering the stoploss hunt
    • How to build a position?
      • Why separate your systems to build a position?
    • The rules to build a position
      • Choose an appropriate strategy
      • Define an opening range
      • Recheck the market conditions
    • Source code to build a position
      • Example of position building
    • Example of a built position
  • Efficiency environment
    • Concept and definition
    • Limit the risk of uncertainty
      • The equation of the efficient environment
      • The voluntary under-optimization of the system
      • Management of trading systems
    • The limitation to the known market
      • Normal functioning of the market
      • Normal working condition
      • The unprecedented events
    • Closed or broken markets
      • Quotation problems
      • Null or very few volumes
      • Detect the without body candles
  • Is my trading strategy becoming obsolete?
    • The cycle of a trading strategy
    • Automated strategy lifetime
      • Relationship between the timeframe and the lifetime
    • The obsolescence signs
      • The increase in the time in the market
      • The increase of the time in latent loss
      • The increase in the variance of the return
      • The spread increase retest
      • The stop-loss is too near to a support
      • The market dangerously comes near your stop-loss
  • Backtest summary
    • The more probable behavior of a trading system


V. Management of the automated trading systems

  • Acceptance tests of the automated trading systems
    • The acceptance recipe
    • Example of an acceptance recipe
      • Acceptance recipe of the overfitting risk management
  • The production launching steps
    • The validation of the prerequisites
      • Validation of the acceptation
      • Automated trading preferences
      • Details of the trading system
      • Risk management
    • The putting in production
      • Relaunch a backtest
      • Send the trading system to ProOrder
      • Start the robot
      • Confirm the launch
      • Activation and verification after production launching
  • Opened entry monitoring
    • Create a specific interface dedicated to the monitoring
      • The ProOrder AutoTrading window
      • Opened entries window
      • Price charts
      • My dedicated interface to the system management interface
    • Manually regain an entry
      • Why manually regain an entry?
      • How to manually regain an opened entry?
    • Crash of an automated trading system
  • Manage the technical incidents
    • The different types of incidents
    • What to do in case of quotation failure?
      • Prepare your action plan
      • Quotation failure from a marketplace
      • Quotation failure of derivatives
    • What to do in case of trading safeguards activation?
      • Exploding of the spread
    • What to do in case of network failure?
      • Have a second network connection
      • Contact the customer service
    • What to do in case of an automated trading system crash?
    • Infrastructure monitoring
      • IG trading platform status
      • Marketplace status
  • The continual checking of the trading system efficiency
    • The continued test running
    • Analysis of opened entries
    • Know the not managed and not tested events
  • Strategy management using z-score
    • Management methods of trading systems
    • The series of losses risk
    • Description of the decision model
    • Calculation and measure of the z-score
      • Calculation of the z-score in Excel
    • Z-score management rules
      • Remind about the z-score interpretation
      • Decision threshold to stop a strategy
      • Management rules to stop a strategy
      • Management rule to stop a strategy
      • Management rule to start a new strategy
    • Example of the z-score using on a real account
    • The limits of the z-score using

Overall conclusions

References and Bibliography


  • Source code to find a trading strategy
    • Source code to four technical indicators
    • Source code to five technical indicators
    • Five moving averages crossings
  • Chartist indicator
    • Euclidian recognition of the green hammer
  • Complete source code of an automated strategy



Secure payment Installation support Free updating Expertise









11 reviews for Automated trading using Prorealtime – Ebook

  1. Christer Hedman

    Wow! I’ve just read the table of contents… it’s really impressive! It looks like a really good introduction to automated trading. How many hours have you worked on the book?

    This looks like an awesome new book about automated trading using Prorealtime from @ArtificallCom. Check out the table of contents. Both scope and depth looks really impressive.

    I bought your book now. Looking forward to read it and add some of your knowledge and insights to my own.

    • Vivien Schmitt

      Hi Christer,

      Thank you for purchasing and for your comment 🙂
      I spent a complete year writing and translate this ebook. It was tough but a great experience.

      Thank you once again 🙂

  2. Traderherz

    Congrats to Vivien from for publishing the english version of his ebook about automated trading!

    Good, good work Vivien! Congratulations!!

  3. ProRealAlgos

    Looking to learn more about automated trading with a starting point in the
    @ProRealTime trading software?

    There are things to learn for both beginners aswell as experienced developers in this e-book.

    Written by Vivien @ArtificallCom, a big contributor to the community!

  4. Mattias Hansson

    Just bought it. Looking forward to have a look through it The coming week

  5. RoboFuturesTrdr

    Grabbed a copy and its looking great

    Ruark Baker

  6. Peter

    The prorealtime programming guide doesn’t explain in detail how the code works. This book fill in some gaps and has quite a few examples and ideas. It has paid for itself quickly just on use of the ‘QUIT’ instruction alone. I am finding it very helpful.

  7. Olivier T.

    This book is impressive: it combines multiple disciplines such software engineering, math, trading of course…
    it is very clear with simple to understand. Congratulations to the author!

  8. Dré à Campo

    This book is a goldmine for developers of automated trading systems, not only for those who are using Pro Real Time. I have been developing automated systems now for a year, and this book gave me the confirmation that I am on the right way. Several of the concepts that I implemented, are also proposed in this book. Furthermore it provided me with many new ideas and improvements for my systems. Especially a lot of attention is given to risk management, backtesting and how to avoid the pitfall of over optimizing your systems (curve fitting). Furthermore the questions I had where promptly answered by the author.

    I definitely recommend this book.

  9. Dimitri

    I purchased your ebook “Automated trading using Prorealtime” and I just finished reading it.

    First of all, THANK YOU! I really appreciate you putting your time and energy into creating such a valuable resource! I enjoyed reading it and I’ve learned some new things that I will be applying in my own strategy development.

  10. Stephen

    Hi Vivien,

    Fantastic! Thank you so much, am really looking forward to reading through the new version. The first one was excellent and helped develop my algo strategies.

    Loving your work!


  11. Andrew

    Thank you very much Vivien!
    I will read it with interest.

    See you soon

Only logged in customers who have purchased this product may leave a review.