Machine Learning in ProOrder ProRealTime

Viewing 15 posts - 361 through 375 (of 455 total)
  • Author
    Posts
  • #128705 quote
    zilliq
    Participant
    Master

    New test, again..:-)

    I think may be the values for rep, increment and so on..wasn’t good. So I did a backtest on it !

    It’s much better, but with a lot less profit than the stupid simple crossing average code. But less trades

    Next…

    GraHal and Paul thanked this post
    #128741 quote
    Bard
    Participant
    Master
    That’s a bunch of time wasted. Knew there was something off but not exactly what. At least v4 ts had this covered.

    I never look at this as wasted effort, because all the time I’m working on these systems (even with an unrealistic trailing stop), I’m constantly still thinking of new ideas to try out and develop.

    Re: Renko ML2 1Month v4 ts (Trailing Stop). That was a such a great idea on coming up with the ML2 Boxsize L/S concept. Really smart, because I’ve been testing/experimenting Boxsize L/S v4 ts against ML1’s for Long and Short boxsizes governed by just ValueX, against ML1’s just for either boxsize or ML1’s on the take profit number and your ML2 Boxsize L/S performs far better.

    I wondered though, how does it know if it should use percentage or points for stops, what determines that switch?

    I did play around with the sophisticated ts settings, doing optimisations and manually changing figures. I tried different percentages for ts1, 2 and 3 but couldn’t get profit to vary. My thought is that the system maybe needs to be really allowed to “breath“ and make out like a bandit whenever possible rather than being restricted with a smart plan to tighten the ts when the profits climb to squeeze more profit out of the position. I then replaced the ts code with the standard TP at 500 and the new pLoss at 50 (now that we know trailing stops are pointless with tbt tests) and it performs even better. About another £10k better on the Nikkei Ap2018-2020. Please see image.

    Can we trust “pLOSS 50” being respected properly by tbt test though? Seems to be throwing up far less tbt warnings, most of those being triggered by edits to settings 1 & 2.

    Tomorrow I am going to see if I can get an ML3 working, so far not, maybe because of the wrong cycle heuristic code. But I noticed with the Ehlers Oscillators with an attempted ML3 system (2 correctly working ML’s and the third not being factored into the profit performance), that it produced better profits when the 3rd albeit not fully working ML3 was added compared to the ML2 version (x for long entry threshold and y for short entry).

    #128759 quote
    Paul
    Participant
    Master
    I wondered though, how does it know if it should use percentage or points for stops, what determines that switch?
    I wasn’t sure what I preferred best, so I added them both to compare quickly. Tend to prefer %. The v4 ts version came to a loss of 50 points yesterday but before it het +220 points gain. Candles are read when they are done so if using daily timeframe it looks this ts isn’t a good solution to take profit in the same day/candle. A profit target should work though as you said. now again it tipped +150 for this day.
    Can we trust “pLOSS 50” being respected properly by tbt test though?
    yes I think so but it can be bigger when there are gaps.
    #128818 quote
    Paul
    Participant
    Master
    @zilliq hi, do you have any change/improvement on the ML engine we could test out (demo) live? I’ve running code with / without ML and they have the same results. Thanks! ps added pic v4 ts
    #128839 quote
    zilliq
    Participant
    Master
    Hi @paul Not sure to understand You ask if I did a change in the ML code ? If so, the answer is no I use the simple/stupid strategy and add the ML with 3 trials (With the version of Grahal, yours et the one of Brad) And as you see, I see no improvement I reply to your question ?
    Paul thanked this post
    #128846 quote
    Paul
    Participant
    Master
    Here’s try on 1 ML engine, choosing from in this case 5 best optimisation results (from without ML). So it means 1 ML engine can have many parameters. On short timeframe, run optimisation a few days later and add that the first 5 and build a database. Makes it sense? No!  Still fun to try.
    startingvalue   = 1 //5, 100, 10 boxsize
    increment       = 1 //5, 20, 10
    maxincrement    = 5 //5, 10 limit of no of increments either up or down
    reps            = 5 //1 number of trades to use for analysis //2
    maxvalue        = 5 //20, 300, 150 //maximum allowed value
    minvalue        = 1 //5, minimum allowed value
    
    //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
    
    if valuex=1 then
    boxsizeL=5
    boxsizeS=50
    elsif valuex=2 then
    boxsizeL=15
    boxsizeS=40
    elsif valuex=3 then
    boxsizeL=40
    boxsizeS=30
    elsif valuex=4 then
    boxsizeL=5
    boxsizeS=25
    elsif valuex=5 then
    boxsizeL=10
    boxsizeS=45
    endif
    
    graph valuex
    //graph boxsizel
    //graph boxsizes
    nonetheless thanked this post
    #128847 quote
    GraHal
    Participant
    Master
    So it means 1 ML engine can have many parameters
    Hahah great idea … you’ve leveraged the ML engine! Thank You for sharing Paul
    #128861 quote
    Paul
    Participant
    Master
    I reply to your question ?
    Yes fully thanks!   @Bard About the ts on a daily tf. If using mtf, but daily without updateonclose for the % trailingstop, would it be correctly done if onmarket & exited on the same daily bar? Or need the ts to be modified for that? Anyway todays result +500! Who thought a target 500 points would make sense lol! Can take a few losses of 50 points now 🙂
    #128899 quote
    Bard
    Participant
    Master
    Excellent idea, re leveraging the ML engine! How would the code be written for Renko ML1 to actually self optimise and try out and step through those 5 values in lines 95 to 110? I can’t picture it.
    If using mtf, but daily without updateonclose for the % trailingstop, would it be correctly done if onmarket & exited on the same daily bar? Or need the ts to be modified for that?
    Sorry not following, could you explain more please about what you want to try and achieve with the Multi TF and “without updateonclose” and “would it be correctly done if onmarket & exited on the same daily bar?” If you’re using MTF, which other TF apart from Daily are you referring to? Kerchinnngggg! €337! Take the ts off and let the system rip! (It’s the sound of a shop cash register machine when you open it to put money in it, ha ha) And on the subject of where to turn the ML algo to next: It has to be Money Management and Trade Size!
    #128905 quote
    Bard
    Participant
    Master
    Hi @Paul, or anyone with better coding skills than me, can anyone figure out if this HeuristicsCycle code looks right for an ML3 version? I cannot get an ML3 version (using algo 3 for £/tick N) to work properly when coded. It’s like the ML2’s v4 without the trailing stop, but with one more part added, i.e., number 3 algo and using the line: elsif heuristicsalgo3 = 1 then… When I use it it does not take any trades?  
    HeuristicsCycleLimit = 3
    
    once HeuristicsCycle = 0
    once HeuristicsAlgo1 = 1
    once HeuristicsAlgo2 = 0
    once HeuristicsAlgo3 = 0
    
    If HeuristicsCycle >= HeuristicsCycleLimit Then
    If HeuristicsAlgo1 = 1 Then
    HeuristicsAlgo1 = 0
    HeuristicsAlgo2 = 1
    HeuristicsAlgo3 = 0
    
    ElsIf HeuristicsAlgo2 = 1 Then
    HeuristicsAlgo1 = 1
    HeuristicsAlgo2 = 0
    HeuristicsAlgo3 = 0
    
    ElsIf HeuristicsAlgo3 = 1 Then
    HeuristicsAlgo1 = 0
    HeuristicsAlgo2 = 0
    HeuristicsAlgo3 = 1
    EndIf
    
    HeuristicsCycle = 0
    EndIf
    
    If HeuristicsAlgo1 = 1 Then
    The only way I can get the Value Z Money Mgt algo = “N” to work (pls see screens and GraphZ blue line) is to use the “HeuristicsCycleLimit = 2” version and then // out the “elsif heuristicsalgo3 = 1 then” line of code. I have had that blue line work to the end to other tests. I have tried ValueZ replacing the N’s in the buy code but get an error from PRT asking me to report. Maybe N cannot be ValueZ? I really think though if N can be replaced with ValueZ and we can get the money management ML3 algo coded right the performance will increase. I’ve seen it do £25k in two months using N in the buy code before a tbt warning came on. I’ve attached the “work in progress” Renko ML3 V4 below.
    #128942 quote
    GraHal
    Participant
    Master
    can anyone figure out if this HeuristicsCycle code looks right for an ML3 version?
    Try below …
    HeuristicsCycleLimit = 3
     
    once HeuristicsCycle = 0
    once HeuristicsAlgo1 = 1
    once HeuristicsAlgo2 = 0
    once HeuristicsAlgo3 = 0
     
    If HeuristicsCycle >= HeuristicsCycleLimit Then
    If HeuristicsAlgo1 = 1 Then
    HeuristicsAlgo1 = 0
    HeuristicsAlgo2 = 1
    HeuristicsAlgo3 = 0
     
    ElsIf HeuristicsAlgo2 = 1 Then
    HeuristicsAlgo1 = 0
    HeuristicsAlgo2 = 0
    HeuristicsAlgo3 = 1
     
    ElsIf HeuristicsAlgo3 = 1 Then
    HeuristicsAlgo1 = 1
    HeuristicsAlgo2 = 0
    HeuristicsAlgo3 = 0
    EndIf
     
    HeuristicsCycle = 0
    EndIf
     
    If HeuristicsAlgo1 = 1 Then
    Paul and Bard thanked this post
    #128979 quote
    Paul
    Participant
    Master
    If you’re using MTF, which other TF apart from Daily are you referring to?
    it’s daily with updateonclose and daily without updateonclose as a test. The question is how do we get a trailingstop working in 1 daily candle, where then entry & exit are in that same bar? (and without going to lower timeframes).
    How would the code be written for Renko ML1 to actually self optimise and try out and step through those 5 values in lines 95 to 110? I can’t picture it.
    So those values in those lines 95-110 you put in manually you found in the optimisation sheet. On a 5s timeframe you could daily add 1 or 2. The engine start which valuex which uses that specific boxsize for l&s. If results are good it should stick to it, if not it should take another valuex which has 2 other boxsizes assigned, so it cycles to those 5 or more numbers from valuex. 2ML is better obviously but still I find above interesting. Good to see work started on ML3. We got ML working in a backtest as graph showed, have you seen a difference trying live with and without 2 ML engines?
    #128981 quote
    Paul
    Participant
    Master
    because using ML and a long & short strategy at the same time, how does the engine know which direction is preforming poorly? There is no reference too long or short win% or average gain, it takes all results into account to change all parameters (ml1 or ml1-2) Does that mean focussing a strategy on long specifically and another on short is better?
    #128994 quote
    Paul
    Participant
    Master
    and last one, using 1 ML engine with increments of 5, code of juanj on p1 or p2. it start out at correct 15 up to 50, but when there’s a drop it ends op with 23 which is not with factor 5 and after that everything is off.
    startingvalue   = 20 //5, 100, 10 boxsize
    ResetPeriod     = 1 //Specify no of months after which to reset optimization
    increment       = 5 //5, 20, 10
    maxincrement    = 5 //5, 10 limit of no of increments either up or down
    reps            = 2  //1 number of trades to use for analysis //2
    maxvalue        = 50 //20, 300, 150 //maximum allowed value
    minvalue        = 15 //5, minimum allowed value
    #129001 quote
    Bard
    Participant
    Master
    The question is how do we get a trailing stop working in 1 daily candle, where then entry & exit are in that same bar?
    Do we want to try and “fix” the issue with trailing stops  and tbt tests though? I’m seeing better results with the pLoss=50 and TP=500. Just inadvertently tried a ML3 v4 on a 4 hour timeframe when I was testing something else but the old equity backtest was up from last nights work using incomplete functioning ML3 code: “ML3 kind of works but it’s not optimising with ML1 and ML2.”
    optimise2 = 0
    endif
    // heuristics algorithm 2 end
    endif
    
    //elsif heuristicsalgo3 = 1 then
    
    // Heuristics Algorithm 3 Start ///////////////////////////////
    
    //If HeuristicsAlgo3 = 1 Then
    
    If (onmarket[1] = 1 and onmarket = 0) etc etc
    and look at the performance before the PRT engine finds issue with a candle and throws a “warning spanner into the works,” fortunately late into the test. I hit “close” instead of relaunch because it preserves the test up to the point of failure. The blue GraphZ (because ValueZ has replaced N in the Buy line) is working on its own. Independent of profit from the ML1 and ML2 performance comparisons. 17% Ddown. I wonder what would happen with your great idea to have value 1 to 5 classifiers of the best box sizes? Maybe post you results? There is definitely and edge here with position sizing ML algos.
    have you seen a difference trying live with and without 2 ML engines?
    No Paul because I can’t launch the ML systems on my Demo. Did you get this “can’t go live” warning with your v4 ts? (pls see image 2). How can I launch it on the Demo? It doesn’t like ValueX/Y?
    Does that mean focussing a strategy on long specifically and another on short is better?
    That would make sense! Run the two systems together… The number of permutations for this ML code is mind boggling! 😃
Viewing 15 posts - 361 through 375 (of 455 total)
  • You must be logged in to reply to this topic.

Machine Learning in ProOrder ProRealTime


ProOrder support

New Reply
Author
author-avatar
juanj @juanj Participant
Summary

This topic contains 454 replies,
has 32 voices, and was last updated by Khaled
4 years ago.

Topic Details
Forum: ProOrder support
Language: English
Started: 08/06/2017
Status: Active
Attachments: 207 files
Logo Logo
Loading...