Optimisation fail
Forums › ProRealTime English forum › ProOrder support › Optimisation fail
- This topic has 12 replies, 4 voices, and was last updated 6 years ago by GraHal.
-
-
04/02/2018 at 10:17 PM #6696004/02/2018 at 10:55 PM #6696404/02/2018 at 11:16 PM #66965
here is the code, both variables are used :
12345678910111213141516171819202122232425262728293031323334353637383940414243//trailing stop functiontrailingstart = d //trailing will start @trailinstart points profitclow = (lowest[m](low))-tradepricechigh= tradeprice-(highest[m](high))//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+1elseSET STOP ptrailing 83ENDIF//next movesIF newSL>0 AND clow>trailingstart thennewSL = newSL+clow*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-1elseSET STOP ptrailing 83ENDIF//next movesIF newSL>0 AND chigh>trailingstart thennewSL = newSL-chigh*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF04/03/2018 at 9:29 AM #67002Might sound daft but it can mean that ‘m’ at value 1 gives the highest gain? Make m value fixed at 5 and see if gain reduces in the optimiser results?
What is your range of values for m?
PS / Edit~
You may need a range with a much higher max value for d and m to get a optimised value other than 1 for m ??04/03/2018 at 9:49 AM #6700304/03/2018 at 11:27 AM #6701704/03/2018 at 11:30 AM #6701804/03/2018 at 12:12 PM #6702304/03/2018 at 1:00 PM #67025If you put your full code on here then I will try it the optimiser for you?
It is probably finger trouble / something daft that we have all done before also so we may spot it in your set up where we couldn’t see it when we made the same error!!! 🙂 🙂
04/03/2018 at 1:43 PM #67028@Nicolas : yes i’m sure the values are not set to fixed. The error message just says there is an error, but not which one, that’s why I wrote to PRT.
@GraHal : attached is the code untouched, yes could you optimise it for me please ?
I would be glad if the error was mine, maybe you can find what’s wrong by testing it yourself.
This is Dax 1 min.
04/03/2018 at 4:40 PM #67041Might sound daft but it can mean that ‘m’ at value 1 gives the highest gain?
Apologies for delay, had to take my car for annual MOT! 🙂
It’s what I said above.
See attached for 10k bars and m is at different values
See attached for 100k bars and m stays at vaue = 1
See attached for 100k bars for m range 10 to 250 in step of 10 and m is at different values.Cheers
GraHal1 user thanked author for this post.
04/03/2018 at 11:52 PM #67081Thank you so much ! So I was worrying for nothing…This made me think about several things :
- I can’t see the other possibilities in the report windows when I do the tests, is that normal ?
- DO you have an error message too ?
- my trailing highs/lows snippet doesn’t work, I have to work on it :s
04/04/2018 at 10:07 AM #67111I can’t see the other possibilities in the report windows when I do the tests, is that normal ?
Yes I think we only see 100 results.DO you have an error message too ?
No I got no error message but I didnt leave it running until it finished.My trailing highs/lows snippet doesn’t work, I have to work on it :s
I agree.Rem out Nics stop and substitute a normal pstop and ptrailing to get a quick idea what values would work … I did and it was like 240 and 130 … and even then overall gain was very low, but maybe I didn’t leave it running until optimiser completed?
Just an idea I use sometimes
GraHal -
AuthorPosts