Now with protection from lack of money when opening a position:
I think that's enough. And now I can place this file in the codebase.
Very kind of you.
Can I ask you how does it deal with spikes? For example if a bar closes at a certain value below TP and the next one opens up well over TP.
How does the algorithm behave in that case? Does it close the trade straight away cause the value has gone above TP?
If was gap, then "TP" will be closed at the price of opening of bar:
On your side, on the side of the developer: is it something that worries you or it's something that somewhat compensate itself in the long run?
Like, if it happens two or three times in a day (or more) that there's a low spike, so the next bar opens at a lower value than SL, which means that you lost a significant amount on that trade. Is it something that you want to avoid however you can or it's something that overtime will cancel itself (statistically) with high spikes, where the value at which the next bar opens is above the TP value?