Help with Equity collection bot
Created at 30 Jul 2017, 00:14
TH
Help with Equity collection bot
30 Jul 2017, 00:14
At the moment I have it closing all positions when "ProfitTarget" is reached. You Input the "StartingBalance" so it closes positions with a true nominated profit amount, as opposed to the difference between balance drawdown and equity acting as "ProfitTarget".
What I'd like to do, is after closing all positions on "ProfitTarget", I need it to then update the "StartingBalance" parameter value without needing to stop the bot and manually change it.
[Parameter("Starting Balance ($)", DefaultValue = 5000)] public int StartingBalance { get; set; } [Parameter("Profit Target ($)", DefaultValue = 500)] public int ProfitTarget { get; set; } double _myEquity; protected override void OnStart() { _myEquity = Account.Equity; } Protected override void OnTick() { if (Account.Equity > (StartingBalance + ProfitTarget)) { foreach (var position in Positions) { ClosePosition(position); } } }
Thanks for your time and any help you can offer :)
croucrou
30 Jul 2017, 14:12
Like this?
@croucrou