Good morning, I would like to present the small code that I use to compare the performance of a system on different instruments.
It is based on the fact that normally when we operate in a system we do it based on the money available to do so, but each index has its own value, so at best, a NASDAQ system can apparently generate less performance than a DJI system. But the investment for each lot in NASDAQ is € 425 / lot and in DJI it is € 1400 / lot.
With this small code I seek to “normalize” the return on investment based on money invested and not in batches.
What we do is allocate the amount of money we want in the system and the price that each contract has. This function is responsible for assigning the quantity of lots to approximate that quantity (with a decimal)
At first look we can buy returns and DD for every € 1000 of investment, for example.
To the administrators: in the forum I did notfind a code of this type, if there is one, you can delete this entry without problem. I do not intend to duplicate content.
The downside to this sort of lot size calculation is that inflation is not considered. $1000 back in the 1970’s was worth far more than it is today and stock prices were far lower. So to buy $5000 worth of the Dow Jones back in the 1979’s you would need to have a lot size of somewhere around $9 whereas to buy the same amount today it would be just 20 cents. To keep a constant we would need to add some sort of inflation into our calculation which is not possible.
In reality just buying a lot size based on a % of an index price will work better over time.
The attached image is created using this indicator of your code:
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue