how to close (cancel) all pending trades?

Posted By: webradio

how to close (cancel) all pending trades? - 01/15/15 12:25

how do I close all pending trades? (must work in Train/Test as well)
Code:
for (open_trades)
  if (TradeIsPending) 
    exitTrade(ThisTrade);

?
Posted By: jcl

Re: how to close (cancel) all pending trades? - 01/15/15 12:57

Yes, that should work.
Posted By: webradio

Re: how to close (cancel) all pending trades? - 01/15/15 15:57

Having all pending trades closed as scripted above, shouldn't NumPendingTrades return zero?
Code:
Hedge = 4; 
printf("\nBefore deleting, NumPendingTotal==%d",NumPendingTotal);
for (open_trades) {
  if (TradeIsPending) {
    exitTrade(ThisTrade);
  }
}
printf("\nAfter deleting, NumPendingTotal==%d",NumPendingTotal);


Output:
Code:
Before deleting, NumPendingTotal==4
After deleting, NumPendingTotal==4

(Number four just like hedge mode ist only a coincidence)
Posted By: webradio

Re: how to close (cancel) all pending trades? - 01/23/15 21:59

Anybody? Shouldn't NumPendingTotal decrease immediately after closing a pending trade using exitTrade() ?
Posted By: jcl

Re: how to close (cancel) all pending trades? - 01/26/15 17:49

I don't think so. Global variables are updated before the run() function, not within a TMF.
© 2024 lite-C Forums