Max Position Limit
Max Position Limit
12 Oct 2022, 07:12
Hi,
I currently have a parameter that limits the number of positions the bot will open at a time. However, I am unable to use it the way it is written to run the bot on multiple pairs.
This is the code I currently have:
[Parameter("Position Limit", MinValue = 1, MaxValue = 5, Step = 1, Group = "Risk Management")]
public int PositionLimit { get; set; }
if (Positions.Count < PositionLimit && ...)
Is there a way to write this so it looks strictly at the SymbolName instead and counts the position it has open rather than the account as a whole?
Thank you
Replies
PanagiotisChar
12 Oct 2022, 08:22
Hi there,
An easier option is the below
Positions.Count(x => x.SymbolName == SymbolName)
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar
kurtisnauss
13 Oct 2022, 04:29
RE:
PanagiotisChar said:
Hi there,
An easier option is the below
Positions.Count(x => x.SymbolName == SymbolName)
Need help? Join us on Telegram
Need premium support? Trade with us
Works like a charm... Thank you!
@kurtisnauss
Waxy
12 Oct 2022, 08:14
Assign a label to the positions, it should be an unique label per instance, so there's no risk of conflict.
Example
@Waxy