Balance, order size, stop loss, open and close position price
-
Hello. Nice to meet you and thank you for your backtester application. I've looked into your documentation but unfortunately I still have several questions. I hope you can help me with it.
-
As I understood, when calculating "weights" I should operate by positive and negative numbers as an order of position size. Everytime in your examples you use 1 or -1, and as I understood, it means we will buy 1 contract or sell 1 contract, am I right? If I'd like to buy 10 contracts, I should mark "10"?
-
If I need to close a current open position, should I mark 0 in a "weights"?
-
How do you calculate close position price? Can I send to backtester my close price? As I understood, you just use a candle close price?
-
How do you calculate open position price? Is it an open candle price? Can I mark my open price? For example, it can be the price inside the current candle - breaking through the price level.
-
In my strategies I use a stop loss. To calculate it I need to know the balance. How can I get info about balance using your framework or how should I correctly init it? It's also needed to calculate an order position size.
Thank you for your attention.
-
-
- As I understood, when calculating "weights" I should operate by positive and negative numbers as an order of position size. Everytime in your examples you use 1 or -1, and as I understood, it means we will buy 1 contract or sell 1 contract, am I right? If I'd like to buy 10 contracts, I should mark "10"?
Also a question about order size.
If we are talking about Bitcoin. How do you operate with size? Is it a amount of contracts or amount of coins? -
@scalpingaf Hello, thanks for asking.
- As I understood, when calculating "weights" I should operate by positive and negative numbers as an order of position size. Everytime in your examples you use 1 or -1, and as I understood, it means we will buy 1 contract or sell 1 contract, am I right? If I'd like to buy 10 contracts, I should mark "10"?
-> No, the weights are the allocations to a given asset. In other words, a weight of 0.1 means a 10% allocation to a given asset. In case the sum over absolute weights is larger than 1, we normalize it to 1. No leverage is allowed.
If I need to close a current open position, should I mark 0 in a "weights"?
-> Yes, correct.
- How do you calculate close position price? Can I send to backtester my close price? As I understood, you just use a candle close price?
-> We provide a pre-defined close.
- How do you calculate open position price? Is it an open candle price? Can I mark my open price? For example, it can be the price inside the current candle - breaking through the price level.
-> Good question. No, we just provide a single value for the open price.
- In my strategies I use a stop loss. To calculate it I need to know the balance. How can I get info about balance using your framework or how should I correctly init it? It's also needed to calculate an order position size.
-> That is possible, as the backtester can be used with a "stateful" version which knows the balance, but not intraday, that can be checked at the end of the trading session only.
-
@scalpingaf Also for Bitcoin, the exposure is the fractional allocation for the capital allocated to Bitcoin.
-
@support , thank you for your answers.
I have additional questions:- Do you use an open candle price for opening a new position, right?
- I didn't get how you close the position. If I'll send "weight" = 0, backtester will choose an open candle price for closing current position, right?
-
@scalpingaf Correct, all trades (buy or sell) are taken at the open of the next day you take the decision.