Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.3k
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 2 comments 2 replies
-
You can add condition in front of the self.buy: for example, from: to: |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hello, thank you for your answer. I understand about conditions. My question however was why it initiates another trade if the whole capital is committed to the 1st trade (size = 0.9999) still active and there is no money left. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Maybe yourinitial cash is too large. After you buy 99.999% your cash in stocks, your remaining 0.001% cash may still be able to buy a small amount of stock. You can take a look at the Profit/Loss graph to see how much size you bought in the second action. You can delete the code 'size= .99999' or add the 'not self.position.is_long' to avoid the problem. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
May be your present position is generating some profit which is used for taking the trade. As per documentation If size is a value between 0 and 1, it is interpreted as a fraction of current available liquidity (cash plus [Position.pl] minus used margin). |
BetaWas this translation helpful?Give feedback.
