Forums › ProRealTime English forum › ProOrder support › Machine Learning in ProOrder ProRealTime › Reply To: Machine Learning in ProOrder ProRealTime
03/05/2020 at 5:40 PM
#121286
Should your heuristic code work on strategies that switch position from Long to Short with no bars not onmarket ?
Yip that is the problem. Solution;
Replace this:
1 2 3 |
If onmarket[1] = 1 and onmarket = 0 Then optimize = optimize + 1 EndIf |
With This:
1 2 3 |
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 optimize = optimize + 1 EndIf |