Hi Eugene,
Thanks for the pointer. Just to see the example in working I c&p it and ran it with fixed dollar amount mode and there I see indeed that it works fine. However I wanted to run it in portfolio simulation mode with 5% risk percentage. For this I added a RiskStopLevel:
CODE:
Please log in to see this code.
When I do this and run it on all data in the nasdaq 100 yahoo stocks, I see several "2" or "3" entries that do not match a "1" entry (I hope it's readable):
Position Symbol Quantity Entry Date Entry Price Exit Date Exit Price Profit % Profit $ Bars Held Profit per Bar Entry Name Exit Name MAE % MFE %
Long AAPL 28.666 28-10-1985 2,25 23-10-1986 4,14 83,98 ? 54.162,74 251 ? 215,79 1 MA XU -0,73 117,38
Long AAPL 142.395 8-11-1985 2,57 23-10-1986 4,14 61,09 ? 223.544,15 242 ? 923,74 2 MA XU -8,22 90,32
Long AAPL 82.937 19-12-1985 2,84 23-10-1986 4,14 45,77 ? 107.802,10 214 ? 503,75 3 MA XU -4,84 72,22
Long AAPL 64.150 20-2-1986 3,14 23-10-1986 4,14 31,84 ? 64.134,00 172 ? 372,87 4 MA XU -3,47 55,77
Long MSFT 2.790.533 21-10-1986 0,13 29-10-1987 0,33 151,76 ? 555.086,90 260 ? 2.134,95 2 MA XU -3,31 319,87
Long AAPL 41.362 27-10-1986 4,25 28-10-1986 4,17 -1,89 ? 3.324,96- 2 ? 1.662,48- 1 MA XU -2,95 0,38
Long AAPL 250.874 30-10-1986 4,29 26-10-1987 6,99 62,94 ? 677.343,80 250 ? 2.709,38 1 MA XU -1,28 248,19
Long MSFT 1.839.273 6-11-1986 0,16 29-10-1987 0,33 108,87 ? 316.364,50 248 ? 1.275,66 3 MA XU -10,99 248,35
Long MSFT 566.615 5-1-1988 0,40 4-2-1988 0,35 -12,51 ? 28.346,75- 23 ? 1.232,47- 1 10% -12,50 7,20
Long JAVA 697.675 8-1-1988 2,22 20-1-1988 1,98 -10,81 ? 167.458,00- 9 ? 18.606,44- 1 10% -10,81 7,69
Long AAPL 25.091 12-1-1988 10,51 25-1-1988 10,21 -2,86 ? 7.543,30- 10 ? 754,33- 1 MA XU -9,02 7,04
Long COST 236.150 9-2-1988 9,13 28-3-1988 9,04 -0,99 ? 21.269,50- 34 ? 625,57- 1 10% -0,99 10,90
Long COST 89.667 18-2-1988 10,06 28-3-1988 9,04 -10,16 ? 91.700,51- 28 ? 3.275,02- 2 10% -10,16 0,62
Long PCAR 149.486 6-4-1988 3,83 9-5-1988 3,42 -10,64 ? 60.880,79- 24 ? 2.536,70- 3 10% -10,64 0,64
Long INTC 777.652 8-4-1988 1,02 19-5-1988 0,91 -11,15 ? 88.473,92- 30 ? 2.949,13- 2 10% -11,15 2,63