0 registered members (),
1,094
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: One Night Stand System
[Re: RTG]
#456378
11/20/15 20:07
11/20/15 20:07
|
Joined: Dec 2013
Posts: 568 Fuerth, DE
Sphin
User
|
User
Joined: Dec 2013
Posts: 568
Fuerth, DE
|
The more I debug the more I am confused. I tested 3 different situations and got 3 different results. But all tested Zorro versions behave identical. RTG, you got a lucky Zorro version! And sorry for the long post but most of it are extracts from log files. The debug code is:
bool SMAShortR = rising(SMAShort);
bool SMAShortF = falling(SMAShort);
bool SMALongR = rising(SMALong);
bool SMALongF = falling(SMALong);
printf("\n%s: SMAShort:%.5f (%i|%i), SMALong: %.5f (%i|%i)",Asset,SMAShort[0],SMAShortF,SMAShortR,SMALong[0],SMALongF,SMALongR);
within the run function, that will print each bar the Asset, both SMAs and additionally (1|0) if a SMA is falling or (0|1) if a SMA is rising. Further the run function contains both conditions and prints additional statements if the conditions become true:
if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMAShort[0] > SMALong[0] && rising(SMAShort) && rising(SMALong)) {
Margin = 0.1 * OptimalFLong * Capital;
printf("\nNow I setup a long trade with a margin of %.5f and a BuyStop of %.5f",Margin,BuyStop);
enterLong(0,BuyStop);
}
else if (dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMAShort[0] < SMALong[0] && falling(SMAShort) && falling(SMALong)) {
Margin = 0.1 * OptimalFShort * Capital;
printf("\nNow I setup a short trade with a margin of %.5f and a SellStop of %.5f",Margin,SellStop);
enterShort(0,SellStop);
}
In live trading today for Zorro the conditions do not become true. The results of today:
[199: Fri 20.11.15 00:00] 1.06717
AUD/JPY: SMAShort:87.64640 (0|1), SMALong: 86.44920 (1|0)
AUD/USD: SMAShort:0.71158 (1|0), SMALong: 0.71495 (1|0) <- true short
CHF/JPY: SMAShort:122.14255 (1|0), SMALong: 123.27503 (1|0) <- true short
EUR/JPY: SMAShort:132.20616 (1|0), SMALong: 133.86478 (1|0) <- true short
EUR/USD: SMAShort:1.07097 (1|0), SMALong: 1.11468 (1|0) <- true short
GBP/USD: SMAShort:1.52224 (0|1), SMALong: 1.52888 (0|1)
NZD/CHF: SMAShort:0.65758 (0|1), SMALong: 0.64897 (0|1) <- true long
NZD/JPY: SMAShort:80.34877 (1|0), SMALong: 79.50937 (0|1)
USD/CHF: SMAShort:1.00769 (0|1), SMALong: 0.98152 (0|1) <- true long
USD/JPY: SMAShort:123.03126 (0|1), SMALong: 120.91281 (1|0)
USOil: SMAShort:43.43371 (1|0), SMALong: 44.72632 (1|0) <- true short
But there are no "Now I setup ..." prints, so Zorro does not recognize the conditions are true, although in 7 cases they are. In backtest it depends - if the simulation ends on a Friday, then you will find like for today:
[229: Fri 20.11.15 00:00]
AUD/JPY: SMAShort:87.65658 (0|1), SMALong: 86.45531 (1|0)
AUD/USD: SMAShort:0.71160 (1|0), SMALong: 0.71498 (1|0)
Now I setup a short trade with a margin of 18.10000 and a SellStop of 0.70153
CHF/JPY: SMAShort:122.14400 (1|0), SMALong: 123.27348 (1|0)
Now I setup a short trade with a margin of 99.90000 and a SellStop of 120.74000
EUR/JPY: SMAShort:132.21563 (1|0), SMALong: 133.87261 (1|0)
Now I setup a short trade with a margin of 99.90000 and a SellStop of 130.63700
EUR/USD: SMAShort:1.07096 (1|0), SMALong: 1.11471 (1|0)
Now I setup a short trade with a margin of 53.10000 and a SellStop of 1.06160
GBP/USD: SMAShort:1.52221 (0|1), SMALong: 1.52886 (0|1)
NZD/CHF: SMAShort:0.65756 (0|1), SMALong: 0.64893 (0|1)
Now I setup a long trade with a margin of 0.00000 and a BuyStop of 0.66823
NZD/JPY: SMAShort:80.37250 (1|0), SMALong: 79.50871 (0|1)
USD/CHF: SMAShort:1.00745 (0|1), SMALong: 0.98147 (0|1)
Now I setup a long trade with a margin of 99.90000 and a BuyStop of 1.02221
USD/JPY: SMAShort:123.01745 (0|1), SMALong: 120.91655 (1|0)
USOil: SMAShort:43.51261 (1|0), SMALong: 44.73911 (1|0)
Now I setup a short trade with a margin of 22.60000 and a SellStop of 39.91000
In contrast to live trading Zorro confirms at least the 7 true conditions in the backtest of today as you can see printed, but it does not setup trades. I can imagine that Zorro does not setup new trades on the very last day/bar of the simulation. This can be adjusted e.g. also for last Friday with "EndDate = 20151113;" and the result is similar:
[224: Fri 13.11.15 00:00]
AUD/JPY: SMAShort:86.99101 (0|1), SMALong: 86.74006 (1|0)
AUD/USD: SMAShort:0.71483 (1|0), SMALong: 0.71665 (1|0)
Now I setup a short trade with a margin of 18.10000 and a SellStop of 0.70153
CHF/JPY: SMAShort:122.79858 (1|0), SMALong: 123.53941 (1|0)
Now I setup a short trade with a margin of 99.90000 and a SellStop of 121.67200
EUR/JPY: SMAShort:132.70861 (1|0), SMALong: 134.26398 (1|0)
Now I setup a short trade with a margin of 99.90000 and a SellStop of 131.46501
EUR/USD: SMAShort:1.07799 (1|0), SMALong: 1.11715 (1|0)
Now I setup a short trade with a margin of 53.10000 and a SellStop of 1.06735
GBP/USD: SMAShort:1.51720 (1|0), SMALong: 1.53036 (1|0)
Now I setup a short trade with a margin of 63.20000 and a SellStop of 1.50264
NZD/CHF: SMAShort:0.66013 (1|0), SMALong: 0.64352 (0|1)
NZD/JPY: SMAShort:80.84656 (1|0), SMALong: 79.08822 (0|1)
USD/CHF: SMAShort:0.99684 (0|1), SMALong: 0.97678 (0|1)
Now I setup a long trade with a margin of 99.90000 and a BuyStop of 1.00885
USD/JPY: SMAShort:121.99323 (0|1), SMALong: 121.02335 (1|0)
USOil: SMAShort:45.06625 (1|0), SMALong: 44.92631 (1|0)
Only if you include at least the following Monday (here: EndDate = 20151116) then you'll see the result like expected in all cases - Zorro setup trades if the conditions become true:
[224: Fri 13.11.15 00:00]
AUD/JPY: SMAShort:86.99101 (0|1), SMALong: 86.74006 (1|0)
AUD/USD: SMAShort:0.71483 (1|0), SMALong: 0.71665 (1|0)
Now I setup a short trade with a margin of 18.10000 and a SellStop of 0.70153
(AUD/USD::S) Short 2@0.7015 Entry stop
CHF/JPY: SMAShort:122.79858 (1|0), SMALong: 123.53941 (1|0)
Now I setup a short trade with a margin of 99.90000 and a SellStop of 121.67200
(CHF/JPY::S) Short 2@121.67 Entry stop
EUR/JPY: SMAShort:132.70861 (1|0), SMALong: 134.26398 (1|0)
Now I setup a short trade with a margin of 99.90000 and a SellStop of 131.46501
(EUR/JPY::S) Short 10@131.47 Entry stop
EUR/USD: SMAShort:1.07799 (1|0), SMALong: 1.11715 (1|0)
Now I setup a short trade with a margin of 53.10000 and a SellStop of 1.06735
(EUR/USD::S) Short 5@1.0674 Entry stop
GBP/USD: SMAShort:1.51720 (1|0), SMALong: 1.53036 (1|0)
Now I setup a short trade with a margin of 63.20000 and a SellStop of 1.50264
(GBP/USD::S) Short 4@1.5026 Entry stop
NZD/CHF: SMAShort:0.66013 (1|0), SMALong: 0.64352 (0|1)
NZD/JPY: SMAShort:80.84656 (1|0), SMALong: 79.08822 (0|1)
USD/CHF: SMAShort:0.99684 (0|1), SMALong: 0.97678 (0|1)
Now I setup a long trade with a margin of 99.90000 and a BuyStop of 1.00885
(USD/CHF::L) Long 2@1.0088 Entry stop
USD/JPY: SMAShort:121.99323 (0|1), SMALong: 121.02335 (1|0)
USOil: SMAShort:45.06625 (1|0), SMALong: 44.92631 (1|0)
[...]
[225: Mon 16.11.15 00:00]
The main question is why Zorro does not recognize in live trading if the conditions become true while it does in backtest. Sure, I cannot exclude an error in the script, but I would really like to know where it is because I can't see it. The results in live trading are identical with 1.32, 1.36 and 1.38, the simulation is done with 1.36 only. Thanks, Sphin
|
|
|
Re: One Night Stand System
[Re: DdlV]
#456400
11/21/15 11:37
11/21/15 11:37
|
Joined: Dec 2013
Posts: 568 Fuerth, DE
Sphin
User
|
User
Joined: Dec 2013
Posts: 568
Fuerth, DE
|
Okay, I unterstood that I shall find out which part of the combined conditions exactly fails, that makes sense.
But can anyone point out if the behaviour of Zorro not to open trades at the last bar of the simulation is normal? This is independent of the condition(s) because they are passed through already that moment and the "enter"-command is the very next one to the "print" and there is no condition or similar in between that could be debugged.
Last edited by Sphin; 11/21/15 13:14.
|
|
|
Re: One Night Stand System
[Re: jcl]
#456467
11/24/15 00:59
11/24/15 00:59
|
Joined: Dec 2013
Posts: 568 Fuerth, DE
Sphin
User
|
User
Joined: Dec 2013
Posts: 568
Fuerth, DE
|
The last bar of the simulation is indicated with the EXITRUN flag. Zorro closes all trades on this bar. This is also an interesting information but my question was if Zorro opens a trade on the last bar or is this prevented in advance e.g. because Zorro would close it the same bar anyway? The result from live trading (now with additionally printed dow()) of today makes me a little bit amazed:
[196: Tue 24.11.15 00:00] 1.06305
1 - AUD/JPY: SMAShort:88.00980 (0|1), SMALong: 86.35982 (1|0)
[...]
The "1" for dow() does not correspond to "Tuesday" and in test runs, there is also a "2" like expected. What do you mean with which bars am I using? The script uses a BarPeriod of 1440 and beside of this I think it uses "normal" bars because I did not change any defaults especially concerning bars.
|
|
|
|