ProRealCode - Trading & Coding with ProRealTime™
When I, (if I), get the Robustness Tester to be able to switch on an off
Just a suggestion … I’ve never bothered with the on/off. I do the optimisation, add the vrt code, do the test, then strip it out again and forget about it – no longer needed. Personally, I don’t like having stuff cluttering up the code for no purpose, just in case it throws up some unintended side effect.
For example having used the larger Trailing Stop at 200 to max 300 and had no trouble backtesting Dow Daily 2015 to present, when I went back the smaller previous ranges (10 to 150 for both the Stop and the BoxSize) I immediately got a tbt warning.
It’s due to below …
So if – due to settings / values for TP and SL – there are more than 2,500 instances of TP and SL being hit in the same bar then we get the warning message that tbt has reached it’s limit.
Hi Paul, cheers, not sure why I added them, probably something wasn’t working, it was during a process of trying different things, like your new rules, without While and Wend. They were originally derived from the DocTrading rules from his Pure Renko strategy. Not being a coder I wasn’t sure that the Buy / Sell Stop would be activated unless the condition had been stated first. Good tip for the tbt issues, thanks.
Yes that might be a good idea because Renko ML2 didn’t perform as well as I expected, not like Ehlers Universal Oscillator ML2 that I’ve posted on this thread and which had ValueX for the Longs and ValueY for the Shorts, nor the Renko ML1 ValueX Trailing Stop. So many combinations and new discoveries to be uncovered… 😀renkoMaxL = ROUND(close / boxSizeL) * boxSizeL
renkoMinL = renkoMaxL - boxSizeL
renkoMaxS = ROUND(close / boxSizeS) * boxSizeS
renkoMinS = renkoMaxS - boxSizeS
and still does calculations?
I don’t like having stuff cluttering up the code for no purpose, just in case it throws up some unintended side effect.Like 5 x the profits, which is what happened when I thought it was turned off but wasn’t. Would be nice to get Vonasi’s additional on/off switch code working or otherwise I’ll probably end up settling for VRT and non VRT versions to save time from having to delete VRT and re-add his code to just one system.
due to settings / values for TP and SL – there are more than 2,500 instances of TP and SL being hit in the same bar then we get the warning message that tbt has reached it’s limit.Do you think that it’s possible that there are 2,500 instances of the (ML1, ValueX) Stop Loss being triggered in the same daily candle? Btw TP in all “my” systems TP have always been set at 500, just thought.. that in itself could do with an ML code… Where does it end? 😬 Lol.
Do you think that it’s possible that there are 2,500 instances of the (ML1, ValueX) Stop Loss being triggered in the same daily candle?Only if ML1 and ValueX are variables for TP and SL as that is all the tbt is concerned with. PS Btw if you select text and then click the ‘Quote’ button then the person who you are Quotng will show up in blue (as above) as a link … then if anybody wants to go back to the post all they have to do is click on the blue link. Luckily (in your post above) I remembered my own comments else I would not know who you are talking to! 🙂 🙂
Would be nice to get Vonasi’s additional on/off switch code workingAre you following @Vonasi 2 x instructions below?? Maybe you are getting problems because you are following just one of the 2 x instructions?? Just an idea anyway, as you seem to have tried everything. Also your strategy code may be using a variable in Vonasi VRT code and that is why you get 5 x profits with the VRT code but not without?? You need to click on the blue Vonasi below and read his original post as the code (which I tried to copy for you) has come out garbled and I have to go now, sorry. Alternatively add something like this to your code and then you can simply turn the robustness tester on and off via one variable at the top of the code without the need to search through the code to find the right line to add or remove // from. 1 2 3 4 5 6 7 8 9 RobustnessTest = 0 (robustness test code here) if not RobustnessTest then tradeon = 1 endif (strategy code here)
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:With This:
123 If onmarket[1] = 1 and onmarket = 0 Thenoptimize = optimize + 1EndIf
123 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) Thenoptimize = optimize + 1EndIf
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
StartingValue = 40
StartingValue2= 30
once ValueX = StartingValue
once ValueY = StartingValue2
EndIf
and change below
//StartingValue = 40 //100, 10 Boxsize
Increment = 5 //20, 10
MaxIncrement = 15 //10 Limit of no of increments either up or down
Reps = 3 //Number of trades to use for analysis //2
MaxValue = 40 //300, 150 //Maximum allowed value
MinValue = 15 //Minimum allowed value
//once valueX = StartingValue
same valuey
//Settings 1 & 2
StartingValue = 40 //100, 10 Boxsize
Increment = 5 //20, 10
MaxIncrement = 15 //10 Limit of no of increments either up or down
Reps = 3 //Number of trades to use for analysis //2
MaxValue = 40 //300, 150 //Maximum allowed value
MinValue = 15 //Minimum allowed value
StartingValue2= 30 //100, 50 Stop Loss
Increment2 = 5 //5, 10
MaxIncrement2 = 15 //30 Limit of no of increments either up/down //4
Reps2 = 3 //2 Nos of trades to use for analysis //3
MaxValue2 = 30 //300, 200 Maximum allowed value
MinValue2 = 15 //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
Would be nice to get Vonasi’s additional on/off switch code workingDid you read below (click on blue link below) … Vonasi got logical results with and without his VRT code?
returned one result that was identical to with the VRT code in the strategy but turned off.
//-------------------------------------------------------------------------
// Main code : Nneless Renko DJI 1Month v3 Machine Learning (ML2)
//https://www.prorealcode.com/topic/machine-learning-in-proorder/page/3/#post-121130
//-------------------------------------------------------------------------
//https://www.prorealcode.com/topic/why-is-backtesting-so-unreliable/#post-110889
// Definition of code parameters
//DEFPARAM CumulateOrders = False // Cumulating positions deactivated
//defparam preloadbars = 1000
//defparam flatbefore = 080000
//defparam flatafter = 215500
//
//once tradetype = 1 // [1]long&short;[2]long;[3]short
//
//once reenter = 1
//once positionperftype = 1 // [0] reenter always; [1] reenter positionperf < 0
//ctime=time>=080000 and time<180000
n=1
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
EndIf
If HeuristicsAlgo1 = 1 then
//Heuristics Algorithm 1 Start
If onmarket[1] = 1 and onmarket = 0 Then
optimise = optimise + 1
Endif
//Settings 1 & 2
StartingValue = 40 //5, 100, 10 Boxsize
Increment = 10 //5, 20, 10
MaxIncrement = 10 //5, 10 Limit of no of increments either up or down
Reps = 2 //1 Number of trades to use for analysis //2
MaxValue = 200 //20, 300, 150 //Maximum allowed value
MinValue = 5 //5, Minimum allowed value
StartingValue2= 40 //5, 100, 50 Stop Loss
Increment2 = 10 //5, 10
MaxIncrement2 = 10 //1, 30 Limit of no of increments either up/down //4
Reps2 = 2 //1, 2 Nos of trades to use for analysis //3
MaxValue2 = 200 //20, 300, 200 Maximum allowed value
MinValue2 = 5 //5, Minimum allowed value
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 Then
optimise2 = optimise2 + 1
Endif
//Settings 2
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
boxSizeL = ValueX
boxSizeS = ValueY
renkoMaxL = ROUND(close / boxSizeL) * boxSizeL
renkoMinL = renkoMaxL - boxSizeL
renkoMaxS = ROUND(close / boxSizeS) * boxSizeS
renkoMinS = renkoMaxS - boxSizeS
IF high > renkoMaxL + boxSizeL THEN
renkoMaxL = renkoMaxL + boxSizeL
renkoMinL = renkoMinL + boxSizeL
endif
if low < renkoMinS - boxSizeS THEN
renkoMaxS = renkoMaxS - boxSizeS
renkoMinS = renkoMinS - boxSizeS
ENDIF
//
//c1 = renkoMaxL + boxSizeL
//c2 = renkoMinS - boxSizeS
// Conditions to enter long positions
//If c1 then
Buy N CONTRACT at renkoMaxL + boxSizeL stop
//EndIf
// Conditions to enter short positions
//If c2 then
Sellshort N CONTRACT at renkoMinS - boxSizeS stop
//EndIf
// Stops and targets
//SET STOP %loss 0.5
Set stop ptrailing 50 //100
SET TARGET PPROFIT 500 //Orig 150 //Best 500
graphonprice renkomaxl + boxsizel coloured(0,200,0) as "renkomax"
graphonprice renkomins - boxsizes coloured(200,0,0) as "renkomin"
GRAPH ValueX coloured(0,255,0)
GRAPH ValueY coloured(255,0,0)
//graphonprice newsl coloured(0,0,255,255) as "trailingstop atr"
Edit: What does adding once ValueX = StartingValue etc, do that it wasn’t doing before that code was added? Cheers.
Machine Learning in ProOrder ProRealTime
This topic contains 454 replies,
has 32 voices, and was last updated by Khaled
4 years, 1 month ago.
| Forum: | ProOrder: Automated Strategies & Backtesting |
| Language: | English |
| Started: | 08/06/2017 |
| Status: | Active |
| Attachments: | 207 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.