code error in calculations ??
Created at 12 Jul 2017, 17:19
code error in calculations ??
12 Jul 2017, 17:19
hopefully someone could help me ...
this Algop is supposed to close all trades anddelete all orders
once the target is reached.
but it was serval times the bot did close trades WAY too early .. with no appearent reason.
the function is startet OnTick
private void closeWhenTarget(double target) { double profit = target; foreach (Position p in Positions) profit += p.NetProfit; // when profit is negative, we're done if (profit < target) return; // target is reached foreach (Position p in Positions) ClosePosition(p); // close all pending orders foreach (PendingOrder o in PendingOrders) CancelPendingOrder(o); // go sleep Stop(); }
swingfish
13 Jul 2017, 00:47
never mind .. i figured it out .
changed to
:)
@swingfish