Capability to combine multiple numeric tokens arithmetically

Have some interesting ideas about how to improve the software? Let us know in this section!
Post Reply
hassanrs
Posts: 1
Joined: Sun Mar 07, 2021 5:18 pm

Capability to combine multiple numeric tokens arithmetically

Post by hassanrs »

As far as I have figured out, although there is a possibility of customizing a field using numeric token modified with arithmetic operators (+ - / *) and a fixed numeric value. However, it seems it's not possible to customize a field using arithmetic operations with multiple numeric tokens. This limits the possibility of data customization.

For example, if I would like to reduce the variable tick spread to half in a MT5 tick export, I would need to customize the original {AskPrice} field.

A couple of options to customize the AskPrice field would be to use the following equations:

{BidPrice+(AskPrice-BidPrice)*0.5}

or

{BidPrice+BidAskSpread*0.5}

But apparently it's not possible to combine multiple numeric tokens arithmetically. Please advise if this is possible is any other way to implement or if such combinations can be supported in future.

tickstory
Posts: 4883
Joined: Sun Jan 06, 2013 12:27 am

Re: Capability to combine multiple numeric tokens arithmetically

Post by tickstory »

Hi Hassanrs,

Thanks for the input. The customization syntax isn't designed to be a complex language and instead just tries to satisfy the core requirements to tweak field values. As you might imagine, we've received a number of requests that would require us to design a language. Instead, what we are proposing to do is allow .NET based scripting for people who have more "in-depth" requirements. This is being built in our next generation v2 of the software.

For the time-being, you could implement what you need quickly in a language called AWK as follows:

Code: Select all

#!/usr/bin/awk -f
# Set the record delimiter to a comma
BEGIN { FS = ","; OFS = "," }

{
    # If the 5th field is numeric, apply the formula to adjust it
    if ($5 ~ /^[0-9]+$/) {
        # Perform whatever calculation you need based on referencing field numbers and then put it back into field 5 of your dataset
        $5 = $4 + ($5 * 0.5) 
    }
    # Print the modified record
    print $0
}
Obviously, you will need to adjust the calculation as you require. You could also use Excel, but there is a row limit that would be problematic if you are dealing with large datasets.

Hope this helps.

Post Reply