O'Reilly logo

Modeling Maximum Trading Profits with C++ by Valerii Salov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 3

R- and L-Algorithms for Maximum Profit Strategy

The profit-and-loss function that has the arguments prices, strategy, and transaction costs and returns the profit or loss value helps in understanding the concepts of s-function, s-matrix, and s-interval. Having developed these three concepts, they will be useful for construction of the algorithm that evaluates potential or maximum profit and for building the corresponding strategy.

S-FUNCTION AND S-MATRIX

Let me define the following scalar function, S = S(P, C, i, j, k), where P and C, both containing n elements, are the vectors of prices and transaction costs, respectively; i and j are indices taking arbitrary integer values from the closed interval [1, n]; and k is a coefficient converting contract prices into absolute dollar amounts. The vector of transaction costs contains elements expressed as absolute dollar amounts paid per contract per transaction. The coef'ficient k can be computed as the tick value/tick, which is equivalent to the value of a full-point move.

Definition 3.1: S-Function

The following equation defines the s-function:

image

If P, C, and k are constant, meaning that a historical interval of prices and costs is selected for a contract with given specifications, then S is a function of the indices i and j only. The symbol Sij in this case denotes a return value of the function.

Definition 3.2: S-Matrix

All ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required