Thanks George. It makes a pleasant change when someone reports a fault helpfully, rather than with the more common, "It dunt wurk".cuzgeorge wrote:Went back to OOTB settings and all normal again, position still in profit.
This is a strange one. void InsertTakeProfit(int ticket) is only called from within CounOpenTrades(),via this code:
if (OrderTakeProfit() == 0) InsertTakeProfit(TicketNo);
Hard to see how this could be wrong, especially as it is the same code in all my recent bots. I see the trade was taken at 10.03, ModifyOrder() clearly succeeded in changing the TP field and addinh the tp, and yet WBT appears to think it had not got one.
I write appears because I wonder if it is one of those latency thingies again. We all know that a newly-opened trade often appears to be in our order history, but in fact is not until it has been returned by the crim's server. Matt has provided us with industrial-strength checking code to deal with this.
I wonder if the cause could be something similar following an OrderModify() call. Hard to see how. Anybody here able to answer this definitively? Or maybe some strange concatenation of events caused the code to loop endlessly round calling InsertTakeProfit()? Again, hard to see how, but just because I cannot do so does not necessarily mean it cannot happen.
I have added some extra code to V 1h in post 1 to abort the function if the trade returned from the crim's server does actually have a tp - also added something similar to InsertStopLoss().