## Subscribe to Hacker Noon's best tech stories, delivered at noon

Visit Noonification https://noonification.com

promotedCreate Your Own Custom Calculation for Trading Crypto like a Pro [feat. the Crypto-Exchange I Built] by@binaryoverdose

November 11th 2019 646 reads

Custom calculations have just arrived in the latest update of Binary Overdose the realtime cryptocurrency analysis software, let's take a look.

Custom calculations are simple yet very powerful. Essentially it’s the ability to create brand new columns based on data from other columns.

A simple example would be if we loaded “Volume USD”, a column that shows data in full units, we could then create a custom column called “Volume Millions USD”, divide the previous column by 1 million and hide the original.

Of course there are many more advanced use cases than this and we’ll get into some later in this article.

To weigh volume as a metric we can multiply it by the market cap. The lower the volume, the lower the overall score.

- Open the binaryoverdose.com website and click on “Edit”.
- On the bottom right of the dialogue click “Clear Selections”.
- Now open the CryptoCompare menu item in the left panel and select both “Volume 24h $” and “Market Cap $”.
- On the right panel at the bottom click “Add Custom”.
- Give the custom column a name, let’s say “Volume Weighted MC”.
- There should only be 2 available options in the columns selector marked “step 2”. Select both of them. Note that the order you select them in will define which variable name they get assigned, either

or*c0*

.*c1* - Now in the calculation text box (step 4 in the graphic) write the following

and click the “OK” button.`c0*c1`

We could clean this up a little as the number is really quite big. Change the calculation to

`(c0*c1)/1000000`

, make sure the type is set to number and update the title to say “Volume Weighted MC Millions”, now we have something we can actually use.Here’s one I made earlier:

Volume Weighted MC Live Example

Volume Weighted MC Live Example

And here’s a quick YouTube example:

Let’s do another simple one before we work on a more complex example. To create this new ratio we need to divide code repo points by market cap.

Follow the previous steps again but select the “code repo points” and “market cap” columns instead, you can search for them if you don’t want to navigate the menu tree.

Now instead of multiplying the values just divide them. Make sure you divide Market cap by Code Repo Points though as this time the order does matter.

In the example I sorted by the new “RPMC Ratio” field in ascending order as lower numbers are better. I also added a couple of filters, “Market Cap > 100000000” and “RPMC Ratio > 0” just to filter out some junk.

Here’s an example: BinaryOverdose Code Repo Points Market Cap Ratio.

For the next example we’re going to create a custom ranking system. Let's say we’re trying to value cryptocurrencies based on our own criteria. To do so we’ll pick a number of metrics that were interested in and assign them points between 0 and 2.

We’ll then add up the points and sort the column in descending order.

At the risk of not overly complicating this example we’ll only pick 3 data points, “Number Of Exchanges”, “Sharpe Ratio 30 Day” and “7 Day Change Against BTC”.

Here’s the calculation. It may look complicated at first but there is only one thing you need to know and its repeated 6 times.

```
(
c0 == 0
? 0
: c0 < 5
? 1
: 2
)
+
(
c1 > 5
? 2
: c1 > -1
? 1
: 0
)
+
(
c2 > 0
? 0
: c2 > -2
? 1
: 2
)
```

Firstly, the

`c0`

, `c1`

and `c2`

variables are assigned automatically as in the previous example. For this calculation they are as follows:```
c0 = Exchanges
c1 = Sharpe Ratio
c2 = 7 Day Change
```

The “c” stands for column if you were wondering.

Anyway, there are a maximum of 2 points assigned for each metric so a grand total of 6 max per result. A breakdown of how they are assigned is below but if you don’t care you can just go to the live example here (I added a few more columns at the end so our calculation wasn’t lonely).

In order to write the calculation we’ll use a JavaScript conditional operator called the ternary operator. It works as follows:

```
condition
? expression if condition is true
: expression if condition is false
```

So if the number of exchanges, lets call that

`c0`

equals 4 and our expression was `c0 < 3 ? 0 : 1 `

then the result of the calculation would be 1 because 4 is not smaller than 3.Because we require multiple conditions we will use a nested ternary operator for each calculation. It may look a little complicated but it should be no worse than an excel function (I know that’s not saying much).

The Number of Exchanges metric is the total number of exchanges that a cryptocurrency is listed on, in this example it will be assigned the variable

`c0`

.```
c0 == 0 // if c0 equals 0
? 0 // then 0 points
: c0 < 5 // else if c0 is between 1 and 4
? 1 // then 1 point
: 2 // otherwise 2 points
```

For Sharpe ratio generally the greater the value of the Sharpe ratio, the more attractive the risk-adjusted return.

So let's say over 5 gets 2 points, between 0 and 4 gets 1 point and under 0 gets 0 points.

Sharpe Ratio will be assigned the variable

`c1`

so our calculation is as follows.```
c1 > 5 // if c1 is greater than 5
? 2 // then 2 points
: c1 > -1 // else if c1 is greater than -1
? 1 // then 1 point
: 0 // otherwise 0 points
```

For this metric we are looking for projects that have recently pulled back so we’ll assign more points if there has been a larger drawdown.

7 day change will be assigned the variable

`c2`

```
c2 > 0 // if c2 is greater than 0
? 0 // then 0 points
: c2 > -2 // else if c2 is greater than -2
? 1 // then 1 point
: 2 // otherwise 2 points
```

Don’t forget to check out the BinaryOverdose website and follow us on Twitter for updates. Leave a comment to let us know your experiences with custom calculations or if you need any help making your own. You can also check out this full feature screencast.

I (Alan), am the founder of Binary Overdose so am obviously biased as to how great it is. Stay tuned for even more powerful custom calculations coming real soon.