I am looking for help with strategy to programmatically manage max loss .
This is the use case.
If I start a position, and the position goes underwater below a preset threshold, I want the program to automatically close the position. Example I take 2 ES longs, and if it goes below $1000 in unrealized loss, I need the program to automatically liquidate the position.
So the program should keep track of current position and its P&L using OnBarUpdate(), I would imagine
The Ninja brokerage is not able to enforce this. They can prevent new position once loss is booked and if loss is more than pre set limit.But they can not auto liquidate live position.
I only trade ES. I have disabled trading in any other instrument. So I will only have just ES at any time.
This will help me avoid'deer in headlight' scenario. I already have enabled max loss with brokerage. Once the limit is reached, brokerage will not let me open new positions.
so combined with this program, I can be assured that my daily loss will not exceed max set limit.
Any pointers on how this can be achieved?
Comment