I have a core.trace producing output to track variables, and you can see two examples of duplicated output:
- Code: Select all
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) STFprice:1.28154, Prev. LTFprice:1.28149, DOAV=0.00047, pivot=1.28182, date:11/6/2012, time:150 11/06/2012 15:00:00
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) STFprice:1.28154, Prev. LTFprice:1.28149, DOAV=0.00047, pivot=1.28182, date:11/6/2012, time:150 11/06/2012 15:00:00
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) STFprice:1.28207, Prev. LTFprice:1.28205, DOAV=0.00108, pivot=1.28197, date:11/6/2012, time:1445 11/06/2012 14:45:02
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) STFprice:1.28240, Prev. LTFprice:1.28205, DOAV=0.00139, pivot=1.28197, date:11/6/2012, time:1430 11/06/2012 14:30:02
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) STFprice:1.28224, Prev. LTFprice:1.28205, DOAV=0.00130, pivot=1.28197, date:11/6/2012, time:1415 11/06/2012 14:15:02
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) STFprice:1.28204, Prev. LTFprice:1.28205, DOAV=0.00120, pivot=1.28197, date:11/6/2012, time:140 11/06/2012 14:00:01
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) STFprice:1.28204, Prev. LTFprice:1.28205, DOAV=0.00120, pivot=1.28197, date:11/6/2012, time:140 11/06/2012 14:00:01
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) STFprice:1.28241, Prev. LTFprice:1.28136, DOAV=0.00171, pivot=1.28151, date:11/6/2012, time:1345 11/06/2012 13:45:00
EUR/USD PIVOTAVERAGE(EUR/USD, 13, 13) PIVOTAVERAGE(EUR/USD, 13, 13) is started. 11/06/2012 13:17:23
EUR/USD MARGINALERT(All accounts) MARGINALERT(All accounts) is started. 11/06/2012 13:15:52
You can see that all of the output is the same for the entries at 1400 and 1500. That's OK, but if a trade is signaled it opens the trade twice. I tried to stop the second update by keeping the time in a variable and returning if it hadn't changed, to no avail. Perhaps the updates run in different threads?
How do I compensate for this? Is this a program structure problem; maybe I should move some of the logic out of the update function? (Not sure I know how to do that; you kind of have to update your signals.) Is there some way for the program to know the update is running more than once and do some things only on one of the passes?