Granted, though my query is that I cannot figure what the logic would be. Please excuse me as I am fairly new to Calgo and have spent a great deal of my time just trying to learn how to correctly write and create algorithms.
Currently I am trying to use this method in my algorithm so as when the desired profit is reached the algorithm will close all positions and stop:
(There is a parameter set for EP)
foreach (var position in Positions)
if (Account.Equity > EP)
Firstly, this method fails to close all positions as the algorithm stops after first position has closed (is there a way to close the positions first and then stop?!)
Secondly I would prefer the algorithm to just close all the positions and continue running and closing positions at the set profit. Obviously using the above once it hits the number defined as ES it will just keep closing positions until below the number
I understand this is a place to gain help and not for code requests, and was not just asking for the code to be written. That is no way to really learn anything.
My problem is that in my mind I cannot figure the logic to turn into code and I have spent a good deal of time pondering on it.
I cannot see how I can use account equity or balance or sum of positions or combinations in any way that does not lead to the same issue I would run into above.