Dear all, I am working on a strategy. Before it start a new position, it will check the latest closed order in the same direction. If the latest closed order in the same direction loose money, no new position will be started. But I found one of the closed order can not be found by:
Code
function lastTradeFail(string direction, int timeDif, bool mute){
	string asset_tmp = Asset;
	for(closed_trades){
		if(strcmp(asset_tmp,"CHF/JPY")==0 && strcmp(Asset,"CHF/JPY")==0 && !mute){	
			printf("\n***********: %s, %.4f, %d, %d",Asset, (var)TradePriceClose, ymd(TradeExitDate), ymd(wdate()));
		}
	}
}

Output of "20200717" (last order start date):
Code
Test: _portfolio4  2020
Assets AssetsFXCMLite_19
Read _portfolio4.fac
Warning 048: trade loop recursion
***********: CHF/JPY, 113.4548, 20200716, 20200717
***********: CHF/JPY, 114.0899, 20200714, 20200717


By comparing the The TradePriceClose and TradeExitDate, I found this order [CHF/JPY::S28133] is missing. This order was recorded in the log file:
Quote

[3281: Thu 20-07-16 14:00] 1994 +22.97 26/19 (113.44)
Warning 048: trade loop recursion
[CHF/JPY::S28133] Short 7@113.45 Risk 24 t at 14:00:00

[3302: Fri 20-07-17 11:00] 1957 +37.26 27/23 (113.84)
[CHF/JPY::S28133] Stop 7@113.91: -24.32


[Linked Image]

After hours of debuging, I don't have a clue any more. Please help ~~~

Attached Files
closed_order_missing.JPG (75 downloads)
Last edited by AdamWu; 07/26/20 01:02.