Bitcoin Forum
June 25, 2024, 05:20:49 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Economy / Trading Discussion / Re: Bitmex Long/Short formulas for excel backtest on: April 19, 2020, 03:35:44 AM
Ok thanks.

I actually get 2 different results from the 2 PnL calculators I've been referencing, neither of which is $7,500... So it seems I actually now have 3 different results for the same equation...

This one (from: btctools.io/calculators/profit-loss)

https://hosting.photobucket.com/images/p468/DM6000/Screen%20Shot%202020-04-19%20at%201.18.38%20pm.png?width=1920&height=1080&fit=bounds

And this one (downloaded from:   ministryofmargintrading.com/bitmex-calculator)

https://hosting.photobucket.com/images/p468/DM6000/Screen%20Shot%202020-04-19%20at%201.18.29%20pm.png?width=1920&height=1080&fit=bounds


Am I doing something wrong here?

***Edit***

The two online calculators are actually the same, they both give the result of .25 BTC profit (although other figures such as ROE are different).
2  Economy / Trading Discussion / Re: Bitmex Long/Short formulas for excel backtest on: April 18, 2020, 02:15:54 PM
Thanks! I like the simplicity of this, just need to clarify a few things…


How is “Value” different from “position” are they the same thing? In this case 75 contracts bought?

And do you mind explaining direction to me?  Is this something that is important for my purposes?



“150-100 * 2 * 75”

The result I get from this is $7,500 which is obviously incorrect:    
[150-100=50]    [50*2=100]      [100*75=7,500]

The online PnL calculators give the result as $56.25 (although with 1x leverage it is $75).

How am I interpreting your formula wrong?

Again, thank you so much for your time!
3  Economy / Trading Discussion / Re: Bitmex Long/Short formulas for excel backtest on: April 18, 2020, 07:41:41 AM
Thanks for the reply!

For the purposes of my backtest I just want a formula that I can apply to historical prices so I guess unrealised PnL would be right as that would equal the trade result if closed at that moment, right?

Does the "value" in that formula represent the position value? i.e. contracts bought?

I also, don't understand the direction formula sorry... do you mean its either minus the sell/short or plus the buy/long... And how do you calculate the short or long in this case?


Apologies for lacking a bit in trading fundamentals, I'm teaching myself all of this stuff with no background in finance/maths but getting there i think...


For example if i went 2x long 75 contracts of BTC with an entry price of $100 and exited that position at $150...

My calculations need to be(?):

Unrealised PnL:      (100 [entry] - 150 [exit]) *

Margin Position:      75[value] * 2[leverage] * [direction?]

Direction:               - (short?)          or           + (long?)


Thanks again.
4  Economy / Trading Discussion / Bitmex Long/Short formulas for excel backtest on: April 17, 2020, 04:18:30 AM
I'm trying to create an excel sheet for backtesting trading ideas and I'm having trouble figuring out the PnL formulas.

I'm primarily using Bitmex so not sure if formulas are the same across other leveraged trading platforms.

I basically want to have a simple sheet where I can start with a certain amount then go long or short (1x) on each historical price that my chosen indicator signals. Then compound that amount over years to get a simple idea of how a strategy might work if strictly adhered to.

(I'm not including fees for the sake of simplicity at this stage.)

I've tried to reverse engineer the "ministry of margin trading" PnL calculator but can't figure out a few key formulas.

Can someone please tell me what formula I need to add to an excel cell to automatically calculate the profit or loss from a Long or short in Bitmex?

If I'm just buying & selling this is easy: =Exit price - Entry price

But with Bitmex PnL calculators the results seem to be quite complicated.

I'm guessing it needs to be = ( (Exit Price - Entry Price) / Something? ) X Leverage

I'd also be grateful if someone can point me towards an existing (unlocked) excel sheet online that I could download for backtesting.

Also very keen to figure out how to code backtests in Trading View, but this is also taking a bit of work. Any tips or links here also greatly appreciated.

Thanks!
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!