Posted By: GPEngine
Duplicate elements in all_trades w/ Entry + EntryTime limits - 10/20/14 02:37
This simple Strategy does enterLong unconditionally at every bar. Then in EXITRUN it prints to file one line for every value in the all_trades list. I ran it against EUR/USD using official data. Then I analyzed the output, counting the occurrences of Bar# in the file.
Observed:
Repeated values for Bar # in the output, each with different values for TradeProfit.
Expected:
No more than one value per bar in the simulation, with an reliable & final value for TradeProfit..
What's happening, here?
Observed:
Repeated values for Bar # in the output, each with different values for TradeProfit.
Expected:
No more than one value per bar in the simulation, with an reliable & final value for TradeProfit..
Code:
#define BUFFSIZE_S 300 char value[BUFFSIZE_S]; function write_line() { sprintf(value, "%u,%f\n", TradeBarOpen, (var)TradeUnits); file_append("all_trades.txt", value); } function run() { StartDate = 20140801; EndDate = 20140901; EntryTime = 2; var atrx = ATR(200); Entry = atrx * 1.0; Stop = atrx * 3.5; if (is(INITRUN)) { file_delete("all_trades.txt"); } enterLong(); if (is(EXITRUN)) { for (all_trades) { write_line(); } } }
Code:
$ cut -d',' -f1 all_trades.txt | sort | uniq -c | sort -rn | head 3 807 2 993 2 990 2 985 2 972 2 957 2 953 2 921 2 836 2 783
Code:
$ grep 807 all_trades.txt 807,772.900024,0.000000 807,772.900024,-2.858410 807,772.900024,-2.866854
What's happening, here?