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.


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:


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 ...

Get Modeling Maximum Trading Profits with C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.