ProRealCode - Trading & Coding with ProRealTime™
Nice! It would be very kind for the community if you could post the .itf file.
Hi Paul, I’ve also been working on applying ML to the vectorial DAX, but so far the results are mixed. Are you using ValueX,Y for the angles?
From the attached you can see that %win is slightly better, Gain/loss is better, but the curve is about the same and profit is less. I’d love to see what you’ve done with it.
Machine learning no learn???
@Fran55 what?
@nonetheless In your code btw, ML only considers positions from not onmarket to market. It ignores results going long->short and visa versa. If you make that change result go up a bit.
here’s what I used as ML But it’s not what makes the results the way they are. I had to optimise all paramaters below to get anywhere near the result without ML.
startingvalue = 24 //5, 100, 10 boxsize
increment = 3 //5, 20, 10
maxincrement = 3 //5, 10 limit of no of increments either up or down
reps = 3 //1 number of trades to use for analysis //2
maxvalue = 35 //20, 300, 150 //maximum allowed value
minvalue = 20 //5, minimum allowed value
startingvalue2 = 21 //5, 100, 50 stop loss
increment2 = 3 //5, 10
maxincrement2 = 3 //1, 30 limit of no of increments either up/down //4
reps2 = 3 //1, 2 nos of trades to use for analysis //3
maxvalue2 = 35 //20, 300, 200 maximum allowed value
minvalue2 = 20 //5, minimum allowed value
heuristicscyclelimit = 2
once heuristicscycle = 0
once heuristicsalgo1 = 1
once heuristicsalgo2 = 0
if heuristicscycle >= heuristicscyclelimit then
if heuristicsalgo1 = 1 then
heuristicsalgo2 = 1
heuristicsalgo1 = 0
elsif heuristicsalgo2 = 1 then
heuristicsalgo1 = 1
heuristicsalgo2 = 0
endif
heuristicscycle = 0
else
once valuex = startingvalue
once valuey = startingvalue2
endif
if heuristicsalgo1 = 1 then
//heuristics algorithm 1 start
if (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) then
optimise = optimise + 1
endif
once valuex = startingvalue
once pincpos = 1 //positive increment position
once nincpos = 1 //negative increment position
once optimise = 0 //initialize heuristicks engine counter (must be incremented at position start or exit)
once mode1 = 1 //switches between negative and positive increments
//once wincountb = 3 //initialize best win count
//graph wincountb coloured (0,0,0) as "wincountb"
//once stratavgb = 4353 //initialize best avg strategy profit
//graph stratavgb coloured (0,0,0) as "stratavgb"
if optimise = reps then
wincounta = 0 //initialize current win count
stratavga = 0 //initialize current avg strategy profit
heuristicscycle = heuristicscycle + 1
for i = 1 to reps do
if positionperf(i) > 0 then
wincounta = wincounta + 1 //increment current wincount
endif
stratavga = stratavga + (((positionperf(i)*countofposition[i]*close)*-1)*-1)
next
stratavga = stratavga/reps //calculate current avg strategy profit
//graph (positionperf(1)*countofposition[1]*100000)*-1 as "posperf1"
//graph (positionperf(2)*countofposition[2]*100000)*-1 as "posperf2"
//graph stratavga*-1 as "stratavga"
//once besta = 300
//graph besta coloured (0,0,0) as "besta"
if stratavga >= stratavgb then
stratavgb = stratavga //update best strategy profit
besta = valuex
endif
//once bestb = 300
//graph bestb coloured (0,0,0) as "bestb"
if wincounta >= wincountb then
wincountb = wincounta //update best win count
bestb = valuex
endif
if wincounta > wincountb and stratavga > stratavgb then
mode1 = 0
elsif wincounta < wincountb and stratavga < stratavgb and mode1 = 1 then
valuex = valuex - (increment*nincpos)
nincpos = nincpos + 1
mode1 = 2
elsif wincounta >= wincountb or stratavga >= stratavgb and mode1 = 1 then
valuex = valuex + (increment*pincpos)
pincpos = pincpos + 1
mode1 = 1
elsif wincounta < wincountb and stratavga < stratavgb and mode1 = 2 then
valuex = valuex + (increment*pincpos)
pincpos = pincpos + 1
mode1 = 1
elsif wincounta >= wincountb or stratavga >= stratavgb and mode1 = 2 then
valuex = valuex - (increment*nincpos)
nincpos = nincpos + 1
mode1 = 2
endif
if nincpos > maxincrement or pincpos > maxincrement then
if besta = bestb then
valuex = besta
else
if reps >= 10 then
weightedscore = 10
else
weightedscore = round((reps/100)*100)
endif
valuex = round(((besta*(20-weightedscore)) + (bestb*weightedscore))/20) //lower reps = less weight assigned to win%
endif
nincpos = 1
pincpos = 1
elsif valuex > maxvalue then
valuex = maxvalue
elsif valuex < minvalue then
valuex = minvalue
endif
optimise = 0
endif
// heuristics algorithm 1 end
elsif heuristicsalgo2 = 1 then
// heuristics algorithm 2 start
if (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) then
optimise2 = optimise2 + 1
endif
once valuey = startingvalue2
once pincpos2 = 1 //positive increment position
once nincpos2 = 1 //negative increment position
once optimise2 = 0 //initialize heuristicks engine counter (must be incremented at position start or exit)
once mode2 = 1 //switches between negative and positive increments
//once wincountb2 = 3 //initialize best win count
//graph wincountb2 coloured (0,0,0) as "wincountb2"
//once stratavgb2 = 4353 //initialize best avg strategy profit
//graph stratavgb2 coloured (0,0,0) as "stratavgb2"
if optimise2 = reps2 then
wincounta2 = 0 //initialize current win count
stratavga2 = 0 //initialize current avg strategy profit
heuristicscycle = heuristicscycle + 1
for i2 = 1 to reps2 do
if positionperf(i2) > 0 then
wincounta2 = wincounta2 + 1 //increment current wincount
endif
stratavga2 = stratavga2 + (((positionperf(i2)*countofposition[i2]*close)*-1)*-1)
next
stratavga2 = stratavga2/reps2 //calculate current avg strategy profit
//graph (positionperf(1)*countofposition[1]*100000)*-1 as "posperf1-2"
//graph (positionperf(2)*countofposition[2]*100000)*-1 as "posperf2-2"
//graph stratavga2*-1 as "stratavga2"
//once besta2 = 300
//graph besta2 coloured (0,0,0) as "besta2"
if stratavga2 >= stratavgb2 then
stratavgb2 = stratavga2 //update best strategy profit
besta2 = valuey
endif
//once bestb2 = 300
//graph bestb2 coloured (0,0,0) as "bestb2"
if wincounta2 >= wincountb2 then
wincountb2 = wincounta2 //update best win count
bestb2 = valuey
endif
if wincounta2 > wincountb2 and stratavga2 > stratavgb2 then
mode2 = 0
elsif wincounta2 < wincountb2 and stratavga2 < stratavgb2 and mode2 = 1 then
valuey = valuey - (increment2*nincpos2)
nincpos2 = nincpos2 + 1
mode2 = 2
elsif wincounta2 >= wincountb2 or stratavga2 >= stratavgb2 and mode2 = 1 then
valuey = valuey + (increment2*pincpos2)
pincpos2 = pincpos2 + 1
mode2 = 1
elsif wincounta2 < wincountb2 and stratavga2 < stratavgb2 and mode2 = 2 then
valuey = valuey + (increment2*pincpos2)
pincpos2 = pincpos2 + 1
mode2 = 1
elsif wincounta2 >= wincountb2 or stratavga2 >= stratavgb2 and mode2 = 2 then
valuey = valuey - (increment2*nincpos2)
nincpos2 = nincpos2 + 1
mode2 = 2
endif
if nincpos2 > maxincrement2 or pincpos2 > maxincrement2 then
if besta2 = bestb2 then
valuey = besta2
else
if reps2 >= 10 then
weightedscore2 = 10
else
weightedscore2 = round((reps2/100)*100)
endif
valuey = round(((besta2*(20-weightedscore2)) + (bestb2*weightedscore2))/20) //lower reps = less weight assigned to win%
endif
nincpos2 = 1
pincpos2 = 1
elsif valuey > maxvalue2 then
valuey = maxvalue2
elsif valuey < minvalue2 then
valuey = minvalue2
endif
optimise2 = 0
endif
// heuristics algorithm 2 end
endif
//
angle1 = valuex
angle2 = valuey
It ignores results going long->short and visa versa.
You can get the ML to include long direct to short and vice versa … but you know that?
Juanj provided some extra code to allow for above … its over on the ML Topic.
I will find it if you need it Nonetheless?
Thanks @GraHal, I’ve got it now. So hard to keep up with all the mods and variations!
Unfortunately even with that change it only just gets up to speed with the non-ML version … but no improvement. 🤔
Nothing
Paul, I just tried your new code which seems to pass with a nice linearity the hectic period 2020. However when I copy your code in PRT, I have an error message on the following variables which would not be used .. ?? please correct if you could, I’m just a beginner in coding. Thank you Paul
NA
angle1 = valuex
angle2 = valuey
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
Hello, jr see that you propose to add a piece of code from Juan in this code proposed by Paul. If you were kind enough to add to Paul’s code. Thank you
N A startingvalue = 24 //5, 100, 10 boxsize
increment = 3 //5, 20, 10
maxincrement = 3 //5, 10 limit of no of increments either up or down
reps = 3 //1 number of trades to use for analysis //2
maxvalue = 35 //20, 300, 150 //maximum allowed value
minvalue = 20 //5, minimum allowed value
startingvalue2 = 21 //5, 100, 50 stop loss
increment2 = 3 //5, 10
maxincrement2 = 3 //1, 30 limit of no of increments either up/down //4
reps2 = 3 //1, 2 nos of trades to use for analysis //3
maxvalue2 = 35 //20, 300, 200 maximum allowed value
minvalue2 = 20 //5, minimum allowed value
heuristicscyclelimit = 2
once heuristicscycle = 0
once heuristicsalgo1 = 1
once heuristicsalgo2 = 0
if heuristicscycle >= heuristicscyclelimit then
if heuristicsalgo1 = 1 then
heuristicsalgo2 = 1
heuristicsalgo1 = 0
elsif heuristicsalgo2 = 1 then
heuristicsalgo1 = 1
heuristicsalgo2 = 0
endif
heuristicscycle = 0
else
once valuex = startingvalue
once valuey = startingvalue2
endif
if heuristicsalgo1 = 1 then
//heuristics algorithm 1 start
if (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) then
optimise = optimise + 1
endif
once valuex = startingvalue
once pincpos = 1 //positive increment position
once nincpos = 1 //negative increment position
once optimise = 0 //initialize heuristicks engine counter (must be incremented at position start or exit)
once mode1 = 1 //switches between negative and positive increments
//once wincountb = 3 //initialize best win count
//graph wincountb coloured (0,0,0) as “wincountb”
//once stratavgb = 4353 //initialize best avg strategy profit
//graph stratavgb coloured (0,0,0) as “stratavgb”
if optimise = reps then
wincounta = 0 //initialize current win count
stratavga = 0 //initialize current avg strategy profit
heuristicscycle = heuristicscycle + 1
for i = 1 to reps do
if positionperf(i) > 0 then
wincounta = wincounta + 1 //increment current wincount
endif
stratavga = stratavga + (((positionperf(i)*countofposition[i]*close)*–1)*–1)
next
stratavga = stratavga/reps //calculate current avg strategy profit
//graph (positionperf(1)*countofposition[1]*100000)*-1 as “posperf1”
//graph (positionperf(2)*countofposition[2]*100000)*-1 as “posperf2”
//graph stratavga*-1 as “stratavga”
//once besta = 300
//graph besta coloured (0,0,0) as “besta”
if stratavga >= stratavgb then
stratavgb = stratavga //update best strategy profit
besta = valuex
endif
//once bestb = 300
//graph bestb coloured (0,0,0) as “bestb”
if wincounta >= wincountb then
wincountb = wincounta //update best win count
bestb = valuex
endif
if wincounta > wincountb and stratavga > stratavgb then
mode1 = 0
elsif wincounta < wincountb and stratavga < stratavgb and mode1 = 1 then
valuex = valuex – (increment*nincpos)
nincpos = nincpos + 1
mode1 = 2
elsif wincounta >= wincountb or stratavga >= stratavgb and mode1 = 1 then
valuex = valuex + (increment*pincpos)
pincpos = pincpos + 1
mode1 = 1
elsif wincounta < wincountb and stratavga < stratavgb and mode1 = 2 then
valuex = valuex + (increment*pincpos)
pincpos = pincpos + 1
mode1 = 1
elsif wincounta >= wincountb or stratavga >= stratavgb and mode1 = 2 then
valuex = valuex – (increment*nincpos)
nincpos = nincpos + 1
mode1 = 2
endif
if nincpos > maxincrement or pincpos > maxincrement then
if besta = bestb then
valuex = besta
else
if reps >= 10 then
weightedscore = 10
else
weightedscore = round((reps/100)*100)
endif
valuex = round(((besta*(20–weightedscore)) + (bestb*weightedscore))/20) //lower reps = less weight assigned to win%
endif
nincpos = 1
pincpos = 1
elsif valuex > maxvalue then
valuex = maxvalue
elsif valuex < minvalue then
valuex = minvalue
endif
optimise = 0
endif
// heuristics algorithm 1 end
elsif heuristicsalgo2 = 1 then
// heuristics algorithm 2 start
if (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) then
optimise2 = optimise2 + 1
endif
once valuey = startingvalue2
once pincpos2 = 1 //positive increment position
once nincpos2 = 1 //negative increment position
once optimise2 = 0 //initialize heuristicks engine counter (must be incremented at position start or exit)
once mode2 = 1 //switches between negative and positive increments
//once wincountb2 = 3 //initialize best win count
//graph wincountb2 coloured (0,0,0) as “wincountb2”
//once stratavgb2 = 4353 //initialize best avg strategy profit
//graph stratavgb2 coloured (0,0,0) as “stratavgb2”
if optimise2 = reps2 then
wincounta2 = 0 //initialize current win count
stratavga2 = 0 //initialize current avg strategy profit
heuristicscycle = heuristicscycle + 1
for i2 = 1 to reps2 do
if positionperf(i2) > 0 then
wincounta2 = wincounta2 + 1 //increment current wincount
endif
stratavga2 = stratavga2 + (((positionperf(i2)*countofposition[i2]*close)*–1)*–1)
next
stratavga2 = stratavga2/reps2 //calculate current avg strategy profit
//graph (positionperf(1)*countofposition[1]*100000)*-1 as “posperf1-2”
//graph (positionperf(2)*countofposition[2]*100000)*-1 as “posperf2-2”
//graph stratavga2*-1 as “stratavga2”
//once besta2 = 300
//graph besta2 coloured (0,0,0) as “besta2”
if stratavga2 >= stratavgb2 then
stratavgb2 = stratavga2 //update best strategy profit
besta2 = valuey
endif
//once bestb2 = 300
//graph bestb2 coloured (0,0,0) as “bestb2”
if wincounta2 >= wincountb2 then
wincountb2 = wincounta2 //update best win count
bestb2 = valuey
endif
if wincounta2 > wincountb2 and stratavga2 > stratavgb2 then
mode2 = 0
elsif wincounta2 < wincountb2 and stratavga2 < stratavgb2 and mode2 = 1 then
valuey = valuey – (increment2*nincpos2)
nincpos2 = nincpos2 + 1
mode2 = 2
elsif wincounta2 >= wincountb2 or stratavga2 >= stratavgb2 and mode2 = 1 then
valuey = valuey + (increment2*pincpos2)
pincpos2 = pincpos2 + 1
mode2 = 1
elsif wincounta2 < wincountb2 and stratavga2 < stratavgb2 and mode2 = 2 then
valuey = valuey + (increment2*pincpos2)
pincpos2 = pincpos2 + 1
mode2 = 1
elsif wincounta2 >= wincountb2 or stratavga2 >= stratavgb2 and mode2 = 2 then
valuey = valuey – (increment2*nincpos2)
nincpos2 = nincpos2 + 1
mode2 = 2
endif
if nincpos2 > maxincrement2 or pincpos2 > maxincrement2 then
if besta2 = bestb2 then
valuey = besta2
else
if reps2 >= 10 then
weightedscore2 = 10
else
weightedscore2 = round((reps2/100)*100)
endif
valuey = round(((besta2*(20–weightedscore2)) + (bestb2*weightedscore2))/20) //lower reps = less weight assigned to win%
endif
nincpos2 = 1
pincpos2 = 1
elsif valuey > maxvalue2 then
valuey = maxvalue2
elsif valuey < minvalue2 then
valuey = minvalue2
endif
optimise2 = 0
endif
// heuristics algorithm 2 end
endif
//
angle1 = valuex
angle2 = valuey
|
paul please can you give us this last strategie vectoriel dax 5 mn abale to learn the last market évolution and correct it ???
thanks so much !!!
NA
hello
do you have the file .itf of this last vectorial dax strategy ?
please
thanks
NA
NEW VECTORIALS DAX 5M BASED ON VECTORIAL DAX OF BALMORA74
This topic contains 27 replies,
has 10 voices, and was last updated by Paul
5 years, 8 months ago.
| Forum: | ProOrder support |
| Language: | English |
| Started: | 08/23/2019 |
| Status: | Active |
| Attachments: | 7 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.