dynamic live parameter adjustment
Forums › ProRealTime English forum › ProOrder support › dynamic live parameter adjustment
- This topic has 31 replies, 8 voices, and was last updated 4 years ago by Francesco.
-
-
05/04/2020 at 4:24 PM #129887
@Francesco The code handles both ways, increase & decrease, with either direction and optimisation 0-1 finds out which is best. It’s based on the last trade result.
win -> decrease angle; loss -> increase angle with direction 0
loss -> decrease angle; win -> increase angle with direction 1
I thought about it to be based on ratio mfa/mae, but that’s difficult!
1 user thanked author for this post.
05/05/2020 at 7:22 PM #130126Hey Paul, i’m running a short timeframe system with your dinamic live parameter adjustment with the re-start everyday option. The first 3 days in the backtast it’s everything ok, then these last two days (the system is built to operate since 9 to 22), suddenly the system stop working after some hours.
As you can see from the image, in the first day as the previous 2 everything is normal, then when the days after is restarted it suddenly stops and does not continue where the circle indicates.
I also tried running the system only in the “suspected days” since another hour and it stops anyway. Any clue?05/05/2020 at 8:29 PM #13013305/05/2020 at 11:29 PM #130147Great!
Because of you suggestion francesco I started wondering if there are other ways. How it make it more self learning? Maybe this is a way?
It focus on losses and you still ‘ve to pick a start direction with 0 or 1.
for the boxsize for long (or angle long) it checks performance of the last trade,
if it wins it sticks to the current directions/increments, however if it starts losing and when it reaches the min/max value, it swaps direction to do the opposite and so it’s less depended on a daily reset. Increments are now more important. If the minvalue->maxvalue is big with small increments it takes a while before a swap.
that’s the idea.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149// dynamic parameter adjustment [OPPOSITE ON REACH MIN/MAX LEVEL WITH LOSSES)once periodr = 0 // [0]none;[1]day;[2]week;[3]month;[4]year (reset period)once directionl= 0 // [0] or [1]oppositeonce directions= 0 // [0] or [1]oppositeincrement = 4minvalue = 16maxvalue = 32once valuex = (minvalue+maxvalue)/2once valuey = (minvalue+maxvalue)/2once startvalueL=24once startvalueS=24// main setupif periodr=0 thenif barindex=0 thenlongperf=0shortperf=0endifelsif periodr=1 thenif day<>day[1] thenlongperf=0shortperf=0endifelsif periodr=2 thenif dayofweek=0 thenlongperf=0shortperf=0endifelsif periodr=3 thenif month<>month[1] thenlongperf=0shortperf=0endifelsif periodr=4 thenif year<>year[1] thenlongperf=0shortperf=0endifendifif longonmarket[1] and (not onmarket or shortonmarket) thenif strategyprofit[1]>=strategyprofit[2] thenlongperf=longperf+positionperf(1)*100elselongperf=longperf-positionperf(1)*100endifendifif shortonmarket[1] and (not onmarket or longonmarket) thenif strategyprofit[1]>=strategyprofit[2] thenshortperf=shortperf+positionperf(1)*100elseshortperf=shortperf-positionperf(1)*100endifendifif directionl=1 thenif longperf<>0 thenif longperf>longperf[1] thenif valuex+increment <= maxvalue thenvaluex=valuex+incrementelsevaluex=valuexendifelsif longperf<longperf[1] thenif valuex-increment >= minvalue thenvaluex=valuex-incrementelsevaluex=valuexdirectionl=0endifendifelsevaluex=startvalueLendifanglelong=valuexelseif longperf<>0 thenif longperf>longperf[1] thenif valuex-increment >= minvalue thenvaluex=valuex-incrementelsevaluex=valuexendifelsif longperf<longperf[1] thenif valuex+increment <= maxvalue thenvaluex=valuex+incrementelsevaluex=valuexdirectionl=1endifendifelsevaluex=startvalueLendifanglelong=valuexendifif directions=1 thenif shortperf<>0 thenif shortperf>shortperf[1] thenif valuey+increment <= maxvalue thenvaluey=valuey+incrementelsevaluey=valueyendifelsif shortperf<shortperf[1] thenif valuey-increment >= minvalue thenvaluey=valuey-incrementelsevaluey=valueydirections=0endifendifelsevaluey=startvalueSendifangleshort=valueyelseif shortperf<>0 thenif shortperf>shortperf[1] thenif valuey-increment >= minvalue thenvaluey=valuey-incrementelsevaluey=valueyendifelsif shortperf<shortperf[1] thenif valuey+increment <= maxvalue thenvaluey=valuey+incrementelsevaluey=valueydirections=1endifendifelsevaluey=startvalueSendifangleshort=valueyendifgraph directions coloured(200,0,0)graph directionl coloured(0,200,0)graph valuex coloured(0,200,0) as "long value"graph valuey coloured(200,0,0) as "short value"3 users thanked author for this post.
05/06/2020 at 10:54 AM #13020205/06/2020 at 11:46 AM #130212encountered the problem again
The first thing I think of is that you use used that little snippet and the value for losses is set to 1 (%), so it stops trading after cumulative losses. It could be something else of-course and maybe it’s solved with above code.
05/06/2020 at 12:28 PM #130217The problematic was related to te bullish/bearish detection. Probably the exponential average values reach in some days, through the dynamic adjustment, a certain value that not opens new trades.
1 user thanked author for this post.
05/06/2020 at 3:01 PM #130250Ok, my bad, the problem was not related to a “stuck” in the average values…
I noticed that removing these lines there’s no holes; but it brings the system to more lossess
123456789101112131415if longonmarket[1] and (not onmarket or shortonmarket) thenif strategyprofit[1]>=strategyprofit[2] thenlongperf=longperf+positionperf(1)*100elselongperf=longperf-positionperf(1)*100endifendifif shortonmarket[1] and (not onmarket or longonmarket) thenif strategyprofit[1]>=strategyprofit[2] thenshortperf=shortperf+positionperf(1)*100elseshortperf=shortperf-positionperf(1)*100endifendifYou was right 🙂
1 user thanked author for this post.
05/15/2020 at 3:48 PM #131786Hey Paul or everyone else, i would like to know if and how it’s possible to run an automatic system for a certain time range without using effective money but having it opening positions in “background” (we talked about this time ago in the renk discussion). Then after a time trigger (or a strategyprofit trigger) starting using capital for the position opening.
05/15/2020 at 4:56 PM #131801This is tricky but I have done it before. Basically you need to ‘virtually’ take the positions using the same rules and then keep track of their virtual performance. I use variables called IsLong and IsShort along with variables called LongEntryLevel and ShortEntryLevel
1 user thanked author for this post.
05/15/2020 at 5:33 PM #131807Francesco, could this be something you’re looking for:
https://www.prorealcode.com/blog/learning/how-to-improve-a-strategy-with-simulated-trades-1/
1 user thanked author for this post.
05/15/2020 at 7:53 PM #131825There is also this topic that might be of interest:
https://www.prorealcode.com/topic/simulated-trading/
1 user thanked author for this post.
05/15/2020 at 9:40 PM #131834Francesco, could this be something you’re looking for:
https://www.prorealcode.com/blog/learning/how-to-improve-a-strategy-with-simulated-trades-1/
The very good code of Nicolas is only for short 😉
06/30/2020 at 7:59 PM #137809I was thinking in the case of low tf systems (>30) in order to avoid an hypotetical overfitting of the ML values (max,min,start): what if (using the daily reset mode) we put yesterday’s optimized parameters for tomorrow operativity and going on like this? That reduces the possibility to have ML overfitting based on the fact that the markets does not drastically changes day by day. With this kind of solution we can evolve the ML values in parallel to the changes of the market. Have everyone tried to run a system for a week using last week 200k ML values vs a system for a week with daily optimized values based on yesterday?
I don’t know if i explained myself well, but i hope this can be understandable and interesting 🙂
07/20/2020 at 4:09 PM #139693Sorry if I am clogging this topic continuously but I need a suggestion about an idea.
I would like to know if it’s possible to create a dynamic parameter adjustment like this:
I choose an interval for a parameter of my strategy (for example 10-1000) like the original Paul’s dynamic live parameter adjustment code.
Then, the machine learning algorithm after the closing of the first trade of the day select the most profitable parameter on it between the interval and fix it on the strategy for the rest of the day (so there’s not a continuous fixing trade by trade and not by starting from a parameter and moving following a selected increment value); then there’s the reset for the day after. If it’s possible the first trade of the day should be simulated somehow in order to avoid losses with the vonasi’s simulated trading hint, but it’s not fundamental, I can also achieve a loss starting from a random parameter, the important is having the best one of the first trade fixed for the rest of the day.Is something like this possible? How? I would be really grateful if you can help me because this could be very important for a strategy that I’m developing 🙂
-
AuthorPosts
Find exclusive trading pro-tools on