Can you please explain about this code line?
Atom
17.06.2019
Pandotex


Hello Stocksharp team.

Can you please explain in detail what's the meaning of this line?

https://github.com/Stock...ing/SmaStrategy.cs#L109

Here what "Position", "Volume" means for?

As long as I understand, position means this one?
https://www.investopedia...rms/o/open-position.asp

Thanks



Спасибо:


Support

Фотография
Дата: 17.06.2019
Ответить


Position means this one https://www.investopedia...ms/p/positiontrader.asp

Volume is parameterizable option. You can skip it is your code, but in that case size of your trading algo will be hard coded.
Спасибо:

Pandotex

Фотография
Дата: 17.06.2019
Ответить


I can understand "Volume is parameterizable option". but I still don't understand that line. Would you please elaborate more?

`var volume = Position == 0 ? Volume : Position.Abs().Min(Volume) * 2;`

"Position == 0" means, there are no active orders for selected security?
Why they're comparing to find min value like "Position.Abs().Min(Volume)"? After that why they're multiplying by 2?
Спасибо:

Pandotex

Фотография
Дата: 17.06.2019
Ответить


I assume that that "SmaStrategy.cs" only works with spot trading (no margin or leverage trading).
Given that it is true, I don't understand why we use "position" term here.
Because as long as I understand, "position" term (open position, long position, short position) are only being used in leverage trading.
Спасибо:

Support

Фотография
Дата: 17.06.2019
Ответить


The line mean Revert position. For this operation required double time position with opposite sign. To convert for example 5 position to -5 we need 10 sell order. Min is just modification. You can remote it (remember that is just examples).

SMA works with any market. It depends from connectors, but not from algo.

Orders are not affected on positions. Only trades.

Short positions can possibly on markets or brokers that allow that.



Спасибо:

Pandotex

Фотография
Дата: 19.06.2019
Ответить


Thanks for your explanation.
But I still don't understand "Position" here.
Lets say `Position=5` in here. Then what does it mean for? (selected security is BTC/USDT)
Then it means that I own 5 BTC?
Спасибо:

Pandotex

Фотография
Дата: 19.06.2019
Ответить


Following up previous question, if "Position=-5" here, then what does it mean?
Does it mean that I have 5 USDT in my account of exchange website?
Спасибо:

Support

Фотография
Дата: 20.06.2019
Ответить


Position 5 means 5 BTC in most of popular exchanges. Minus position are possible for crypto exchanges with future contracts. For margin trading it is not allowed and you need modify the algorithm.
Спасибо: Pandotex


Добавить файлы через драг-н-дроп, , или вставить из буфера обмена.

loading
clippy