Posted By: gtell
I am insisting with Machine Learning - 01/07/17 21:43
But I still do not understand some things.
This post is a question to whom has more experience of me.
The question is very simple and regards how Zorro passes data to the R script.
To put in short, consider the following robot:
Let's not consider the efficiency of this startegy.
But, let's have a look to the log:
So, what I expect is that the signals were shifted, if in one bar I get:
0.1, 0.5, -0.2, -0,3
the next bar I should have something like:
0.3, 0.1, 0.5, -0.2
the first value is new and the other are taken from the previous bar.
I do not understand why this is not happening.
Is someone able to explain me?
Thanks.
Cheers
This post is a question to whom has more experience of me.
The question is very simple and regards how Zorro passes data to the R script.
To put in short, consider the following robot:
Code:
#include <r.h> var change(int n) { return scale((priceClose(0) - priceClose(n))/priceClose(0),100)/100; } var range(int n) { return scale((HH(n) - LL(n))/priceClose(0),100)/100; } function run() { StartDate = 2012; BarPeriod = 60*24; LookBack = 100; WFOPeriod = 700; // 1 year DataSplit = 90; NumCores = -1; // use all CPU cores but one set(RULES); set(LOGFILE); Spread = RollLong = RollShort = Commission = Slippage = 0; //LifeTime = 3; int Offset = 0; if(Train) { Hedge = 2; Offset = 1; } var c1=change(1+Offset), c2=change(2+Offset), c3=change(3+Offset), c4=change(4+Offset); var r1=range(1+Offset), r2=range(2+Offset), r3=range(3+Offset), r4=range(4+Offset); var pred = adviseLong(NEURAL,change(1),c1,c2,c3,c4,r1,r2,r3,r4); if(Train) enterLong(); if(Test) { print(TO_LOG, "nSignals: %1.3f,%1.3f,%1.3f,%1.3f,%1.3f,%1.3f,%1.3f,%1.3f", c1,c2,c3,c4,r1,r2,r3,r4); print(TO_LOG, "nPrediction value: %1.3f", pred); if(pred>0.5 && NumOpenLong<1) enterLong(); else if(pred<0.5 && NumOpenShort<1) enterShort(); } }
Let's not consider the efficiency of this startegy.
But, let's have a look to the log:
Code:
[1024: Wed 16.12.15 00:00] -160 -4 54/96 (1.09902) Signals: -0.298,-0.186,-0.004,-0.149,0.400,0.081,-0.104,-0.244 Prediction value: 0.252 [EUR/USD::L2250] Reverse 1@1.09341: -4.43 at 00:00:00 [EUR/USD::S2451] Short 1@1.09341 at 00:00:00 [1025: Thu 17.12.15 00:00] -164 +5 55/96 (1.09329) Signals: -0.320,-0.405,-0.250,-0.129,0.331,0.273,0.094,-0.045 Prediction value: 0.237 [1026: Fri 18.12.15 00:00] -164 +8 55/96 (1.08767) Signals: -0.177,-0.326,-0.340,-0.261,-0.099,0.347,0.405,0.253 Prediction value: 0.428 [1027: Mon 21.12.15 00:00] -164 +6 55/96 (1.08404) Signals: 0.130,-0.022,-0.139,-0.218,-0.199,-0.275,0.173,0.238 Prediction value: 0.739 [EUR/USD::S2451] Reverse 1@1.08695: +5.63 at 00:00:00 [EUR/USD::L2752] Long 1@1.08695 at 00:00:00 [1028: Tue 22.12.15 00:00] -158 +4 56/96 (1.08671) Signals: 0.183,0.224,0.129,-0.019,-0.054,-0.022,-0.191,0.027 Prediction value: 0.698 [1029: Wed 23.12.15 00:00] -158 +7 56/96 (1.09106) Signals: 0.168,0.252,0.297,0.194,-0.116,-0.016,0.022,-0.082 Prediction value: 0.735
So, what I expect is that the signals were shifted, if in one bar I get:
0.1, 0.5, -0.2, -0,3
the next bar I should have something like:
0.3, 0.1, 0.5, -0.2
the first value is new and the other are taken from the previous bar.
I do not understand why this is not happening.
Is someone able to explain me?
Thanks.
Cheers