This is a “machine learning” strategy for finding the best crossing strategy, comparing 70 different averages with each other, given a certain time frame and a certain market.
(The source of the very most of the averages is https://www.prorealcode.com/prorealtime-indicators/average-filter-regression/ posted by Laurenzo in 2017)
The strategy is simple:
If the first average crosses above the second average, go buy long
and vice versa if the first average crosses under the second average, sell short
It can be used for currencies and indices, presumably also for stocks (non-daytrading)
This strategy determines which of the 70 different averages is to be crossed with which of the same 70 different averages to give the best result in a certain market in a certain time frame, what in my opinion can be seen as a kind of “machine learning”
Further added to this strategy: (up to the user to adjust those variables if wanted)
- to protect the position, a stop loss (TSL) is added (coded TSL = round(100/10000*close))
- exit a position every day at 16:00 hr (coded Defparam Flatafter = 160000) (Daytrading)
- limit to only one trade per day (coded OTD = Barindex – TradeIndex(1) > IntradayBarIndex, If using “TradeIndex(3)”, it would allow 2 opening trades per day, TradeIndex(5) would allow 3 trades per day, and so on.
- Opening trades only between 8:00 and 11:30, for American trades other times can be set.
There are 70 different types of averages, (listed below), which are used to cross each other (the first is named MAType, to be crossing the second MATypeV2)
To limit zigzagging of the averages due to market noise, an exponential average of 30 is added before the crossing condition is measured (Coded as wAFR = exponentialaverage[30](AFR) and wAFRv2 = exponentialaverage[30](AFRv2))
To limit the possibilities, the period is set for all average-types to 15 (Coded as Period = 15, Period2 = 15), periods may be adjusted.
Different stop distances can be used or a trailing stop can be used.
Be aware that if you use this “machine learning” on a small set of data, the outcome will be over- fitted and a different optimized set of averages for a different small set of data will appear (this happens with all strategies, robustness of the strategy has to be tested).
Be aware when running the given strategy, already 70 x 70 combinations has to be optimized, which is already 4.900 combinations, which makes the optimizing process (very) slow. It might be a good idea to split the combination into 5 sets, lets say from 0 to 13 averages comparing to the 69 averages, and next 14 to 26 comparing to 69 averages, and so on, then taking the best from the 5 sets.
I run the code first without In Sample/Out of Sample, to find the top 10 best average combinations, and around those top 10 run several In Sample/Out of Sample optimizations.
For In Sample/Out of Sample optimizations use 66% IS and 34% OOS, non repeated (not five runs)
The code is extremely long (> 3.600 lines), due to defining 70 and 70 different averages. Maybe it can be coded shorter ?
The crossing strategy itself can be found at the last rows !
I was not aware that PRT allows more then 3.600 lines of code as a strategy!
- Ahrens Moving Average
1. Adjustable Lag FIR
2. Arnaud Legoux Moving Average
3. 2-Pole Butterworth Smoothing Filter
4. 3-Pole Butterworth Smoothing Filter
5. Corrected Moving Average by A.Uhl
6. d9 Unscented Kalman Filter (Responsiveness Version)
7. d9 Unscented Kalman Filter
8. Double Exponential Moving Average
9. Exponential Least Square Moving Average
10. Exponential Moving Average
11. Elastic Volume Weighted Moving Average
12. Fast Adaptive Trend Line
13. Fractional-Bar Quick Moving Average
14. Fractal Adaptive Moving Average
15. Generalized DEMA
16. 1-Pole Gaussian Filter
17. 2-Pole Gaussian Filter
18. 3-Pole Gaussian Filter
19. 4-Pole Gaussian Filter
20. Hull Moving Average
21. IE/2 Combination of LSMA and ILRS
22. Integral of Linear Regression Slope
23. iTrend by John Ehlers
24. Jurik Moving Average (Responsiveness Version)
25. Jurik Moving Average
26. Kaufman Adaptive Moving Average
27. Kalman Filter by John Ehlers
28. Kalman Filter (Responsiveness Version)
29. Kalman Filter
30. Leader Exponential Moving Average
31. Laguerre Filter by John Ehlers
32. Least Square Moving Average
33. McGinley Dynamic
34. Middle High Low Range Moving Average
35. McNicholl Moving Average
36. Non Lag Moving Average (Responsiveness Version)
37. Non Lag Moving Average
38. One More Average
39. Pentuple Exponential Moving Average
40. Parabolic Weighted Moving Average
41. Quadruple Exponential Moving Average
42. Regularized EMA by Chris Satchwell
43. Reference Fast Trend Line
44. Reference Slow Trend Line
45. Slow Adaptive Trend Line
46. Simple Moving Average
47. 2-Pole Super Smoothing Filter
48. 3-Pole Super Smoothing Filter
49. Smoothed Simple Moving Average
50. Sine Weighted Moving Average
51. T3 Moving Average
52. Triple Exponential Moving Average
53. Triangular Moving Average
54. Time Series Average
55. Variable Index Dynamic Average
56. Variable Moving Average
57. Volume Weighted Average Price
58. Wilder Moving Average
59. Weighted Least Square Moving Average
60. Weighted Moving Average
61. Zero Lag BMT
62. Zero Lag Double Exponential Moving Average
63. Zero Lag FIR Filter
64. Zero Lag IIR Filter
65. Zero Lag John Ehlers
66. Zero Lag Weighted BMT
67. Range based AV high + STD – low – STD
68. Average highest [period] and lowest[period]
69 DEMA adjusted by itself
Please download the attached itf (200308-Averages-crossing.itf) to play around with this strategy.
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Wow!
hello Jan,
this is a fantastic idea but, as per I understood looking into the system, I think it cannot work as an automatic program. I mean that
hello Jan,
this is a fantastic idea but, as per I understood looking into the system, I think it cannot work as an automatic program. I mean that the program is testing the 69+69 options but once it has ended you’ll have 2 fixed numbers as variables. Then you can use it in automatic run. So the variables chosen are referring only to the moment of the test. Am I right?
Yes, that is correct, it helps you select the 2 best kind of averages (out of 70), based on past data, given a market and given a time frame. Then after proper testing, you let the algo running on future market data with this setting.
Thanks for sharing this Jan, I have following settings and winning rate is 70% on 30mins – GBPUSD pair,
DEFPARAM cumulateOrders = False // Cumulating positions deactivate
Defparam flatafter = 160000 //close the position at 16:00 (day trading) /could be switched off
once StartE = 080000 //start time for opening positions
once StartL = 113000 //ending time for opening positions (only trading in the morning)
once N = 1 // number of contracts
once Period = 15 //period1 // // set fixed to limit possible combinations of optimisations
once Period2 = 15 // period2 second set of 69 averages // // set fixed to limit possible combinations of optimisations
MAType = 5
MATypeV2 = 10
Series = (open+high+low+Close)/4 // kind of close of a bar
Seriesv2 = (open+high+low+Close)/4 // kind of close of a bar
OTD = Barindex – TradeIndex(3) > IntradayBarIndex // limits the (opening) trades till x per day (OTD One Trade per Day)
TSL = round(50/10000*close) // dynamic trailing stop loss 0.5 %
OK Jan, do you see a way to let it test and run in automatic mode? something like a loop that anytime is testing the best variables
Interesting discussion.
This algo will be based upon optimal settings, given past data, then assuming the past pattern of data will be repeated, or at least be repeated so much that it delivers profitable trades for the future.
If the model would be using something like a loop that anytime it is testing the best variables, the measures have to be based upon the (short term) past, as future prices still have to come. . .
The question is then of course: will the continuously (short term) past optimal crossing deliver better results for future trading than a setting based upon long term historical data or not ?
If you want something like a loop that anytime is testing the best variables, you do NOT need to have 70 averages to test every time, a simple average compared with the close would already be sufficient and then let the system calculate the best average crossing based upon the last (for example) 40 bars every time. As said the concept is then based upon the assumption that the continuously measured (short term) price movements better predict future price movements as fixed settings, based upon many price movements over a long term. If you or anybody else know more about this, please let me know.
Is there any configuration for this system that tests the best variables
Jan, I’ve understood. Maybe in standard conditions it’s better to test the algo on the maximum time period. But in this period of coronavirus I think, even if we are always testing on past data, it would be better to test on a short period. In fact I’ve tested it for Eu/$ and Dax on 5 minutes base in the period 2march up today and I got gorgeous results with 100% winning trades. While I’m now testing them on 5m and 100.000 and I see only 50%-60% of winning and a low average earning value. If this volatily period will continue I think your algo is really amazing.!!!!
Hi MaoRai54, Did you manage to set the variables in AutoTest, I am trying to create AutoTrading and it’s giving variable errors. Thanks
Been playing around with this awesome code!!!
where can i adjust the matype? i removed the variables allready.. but im a bit stuck.. my coding knowledge only goes soo far.
because it wont let me prepare for auto trade?
Frenqle, if you remove the variables without fixing their values you cannot go for auto trade
Just delete MAType and MATypeV2 at Optimization parameters (straight above the first line of the code)
Then type in the code
Once MAType = what you want to select
Once MATypeV2 = what you want to select
Just a common warning, which is valid for every algo-strategy: make sure it is robust and properly tested, including In Sample and Out of Sample testing.
Hi Jan.
Is there any way to help us find a developer to program an algo-strategy for automatic trading?
Please contact us to work on this revolutionary strategy called: “mouse nibbling at kangaroo jump”.
dankjewel jan!!
i can t make it work for real, can you better details the process please
hi Juan, yes of couse the file is imported. can you send sreenshoot of the process? i m blocked..
Could ypu be more specific ?
Have you imported the itf-file already ?
For let the strategy run (after importing the file):
Just delete MAType and MATypeV2 at Optimization parameters (straight above the first line of the code)
Then type in the code
Once MAType = what you want to select
Once MATypeV2 = what you want to select
Hope it helps.
Hi bertrandpinoy
Where exactly are you blocked ?
If you import the file, you can, given a time frame and a larger period, determine which crossing(s) of 2 averages gives the best results (like a top 10).
Next step is to test this upon another set of data, see if the optimum averages varies significantly or not from the previous test.
And then do an In Sample test of 66% and an Out of Sample Test with 34%, to determine if the best crossings of averages remain the same with the first test. You may restrict the chooseable averages to decrease the time for running this test.
If you find your best 2 averages, follow the steps as I described below.
Hope it helps you out.
KR Jan
Hello Juan I manage to make very promising backtets. unfortunately I fail to launch the program in real mode, what a pity. Certainly my amateurism in the use of variables. damage.Maybe you can attach an ITF file that allows actual use on the CAC40?
Hi Jan
How do i make it run Automatic trading. I get this message “Replace variables with specific values”?
I guess its the the statement you made above, but i still cant get it right!?
Thanks
Hi Jevve,
yes, it is certainly the message above. KR Jan
Hi Jan
After deleting the MAType and MATypev2 in the optimization, i then must type in the code
Once MAType = what you want to select
Once MATypeV2 = what you want to select
But where exactly in the code should i type it in?
thanks
Hi Jevve,
Once MAType = 15 that is one of the moving averages of 0-69
Once MATypev2 = 25 that is one of the second range of moving averages of 0-69
Just a common warning, which is valid for every algo-strategy: make sure it is robust and properly tested, including In Sample and Out of Sample testing, before letting it trade automatically with real money.
which variables should i fill in for in and out of sample? i dont understand these labels and maximum and minimum area’s?
Hi Jevve,
Sorry, just to answer your question: you can type it just below the defined periods, like line 29 in the code. (It has to be coded above all the definitions of the 70+70 averages)
KR Jan
Hi Frenqle,
Determine which crossing(s) of 2 averages gives the best results (like a top 10), without In Sample Out of Sample turned on.
(Next step is to test this upon another set of data, see if the optimum averages varies significantly or not from the previous test.)
And then do an In Sample test of 66% and an Out of Sample Test with 34%, with 1 iteration) to determine if the best crossings of averages remain the same with the first test. You may restrict the chooseable averages (range 0-69 and 0-69) to a smaller range which fits around your best results, to decrease the time for running this test. (Check in the code of the chosen range are somewhere the same sort of averages as the best crossings)
If the IS/OOS values of averages which is in fact based upon optimizing 66% of the first test set of data, varies significant from the averages chosen averages from the first set, it seems that the crossing is over fitted. This is only true,when the averages from the IS/OOS significantly differ from initial test.
Hope it helps you out. En een goed weekend
KR Jan
interessant : comment faire pour l’utiliser en live (message erreurs sur les variables) ?
Interesting : how to make it working in pro order (error message due to variables) ?
See comments above at answers at questions from Jevve, and I should do some additional testing and In Sample Out of Sample, as answered to questions of Frenqle, hopes it helps you out .
A good weekend.
KR Jan
Thank you Sir ! it’s amazing code.
Dear Jan, i managed to test your code and put it into automatic trading.. it runs for a few minutes and then it quits without any reason.. do you care to have a look?
Hello Frenqle, would you be so kind as to send me the working ITF file please? I can’t make it work myself…thank you in advance.
Hello Frenqle if possible please could you also send me the working ITF file please … I also can’t make mine work…Thank you very much
gkjefferys@gmail.com
Hi Frenqle
maybe it has to do with the stop loss setting. Normally when it stop in auto trading there is a warning sign at that strategy, if you click on that, maybe it gives a reason why it stopped.
Generally speaking, in this volatile markets, stops of 1 % are very often stopped out too soon.
Also in this very very volatile market, trending strategies often do not work (for example today Dow at opening – 3% and then 40 minutes later +1% is not to say trending)
Hi Jan,
It just closes without a reason. Even in the report, it says nothing. it does not give any reason.
Very weird, Can I send you the code?
I put line 29 the Matype and Matypv2 = to optimized level but still to go to live pro order is asking to remove variables. Which variables are involved ?
Hi Jan, It just closes without a reason.. even in the report it says nothing.. it doesnot give any reason
Hi darbes,
Did you delete MAType and MATypeV2 at “Optimization parameters” (straight above the first line of the code)
The topic nontheless has opened, is https://www.prorealcode.com/topic/optimization-moving-average-crossing-strategy/
frenqle, you can add your version of the code over there, then I will have a look why it stops in automatic trading.
KR Jan
I opened a topic in the ProOrder forum to make discussion of this easier. Also uploaded 3 algos created with this amazing tool – thanks Jan!
Sorry Jan,
Code is starting with Defparam, I do not find optmization. Where could I desactivate it ?
Best JC
Hi Jan
It is OK I found it
Best
Once MAType = 15 that is one of the moving averages of 0-69
Once MATypev2 = 25 that is one of the second range of moving averages of 0-69
Please can you tell me where i find this … what lines
thanks very much
Hi Jan
I have put live the strategy and so far so good 3 winning deals over 3> But why did you choose to exit position at 4PM. It is not adding an additional closing risk instead of a take profit ?
Best
JC
Hi darbes can you share the code you are using I cant get it to work in auto.
And great work Jan
Hi gkjefferys, the lines can be found somewhere at the top cq must be added somewhere at line +/-15 if that answers your question.
Hi Darbes, exit 16:00 hrs is daytrading, you can whipe that out, but that increase your risk, but also can increase your profit, be aware of overnight interest costs of the CFD you trade
I see. An alternative to take profit is to reduce on forex the TSL below 1% as forex vol is lower during the day. I will first work on this side to avoid closing position in a lottery way at 4PM.
Very interesting Jan, thank you for sharing. This could be a template for many ‘machine learning’ solutions in PRT, I’ll go and see if I can tweak some things, maybe make the code shorter, or add in other indicators while I’m in quarantine :).
Hi J., any progress? Greetings from Germany.Nils
Thank You for sharing that code Jan. One quick question any specific reason why you selected 15 as period and period2. Why these specific values ? And why not different values ?
The source of the very most of the averages is from Laurenzo, he used 15 as a standard average. https://www.prorealcode.com/prorealtime-indicators/average-filter-regression/ posted by Laurenzo in 2017
I have added the Close itself as an 71th “average”
Can I make the average lines visible in a chart? How can I see in the code what is the valid averages for buy and sell?
Yes you can, please find the code at https://www.prorealcode.com/topic/optimization-moving-average-crossing-strategy/page/4 as mentioned before the averages are posted by posted Laurenzo in 2017
Hi, if you fix MAType=45 and MATypeV2=1, on EUR/USD 15min, backtest on 100 000 units, you get a pretty good linear curve. And as the variables are all fixed, in theory it is possible to launch it in automatic trading.
ProRealtime 11 says error code line 24: once StartL = 113000, how to fix? Thank you.
Sorry to hear, I just tested the attached itf file in version 10.3, it works fine there. I did not use version 11 yet, not sure what is going wrong. Could you reload the original itf here again and try again ? As it works in 10.3, why should it not work in 11?
which timeframe do you use ? Do you get the error in the 5 minutes timeframe as well ?
sebastien4484 Have you also found the results with some In Sample/Out of Sample testing, like 66% IS 34% OOS ?
Excellente idée ! Je vais m’en servir comme base intellectuel pour réfléchir au test qui pourrait être fait entre différents indicateurs, différents règlages, et différentes bougies.
Obviously more averages (then the 70 in the strategy) are thinkable, and could be added, I would add the close itself also.
Coded the Close itself below
And
Averagetruerange[Period](Averagetruerange[Period](Close))
Averagetruerange[Period*2](Averagetruerange[Period*2](Close))
To be added for both MAType en MATypeV2, coded below for MAType,
========FIRST AVERAGES AFR========================================
IF MAType = 70 THEN
Period = MAX(Period, 1)
IF BarIndex < Period THEN
AFR = Series
ELSE
AFR = Averagetruerange[Period](Averagetruerange[Period](Close))
ENDIF
ENDIF
IF MAType = 71 THEN
Period = MAX(Period, 1)
IF BarIndex < Period THEN
AFR = Series
ELSE
AFR = Averagetruerange[Period*2](Averagetruerange[Period*2](Close))
ENDIF
ENDIF
IF MAType = 72 THEN
AFR = Close
ENDIF
========SECOND AVERAGES AFRV2=========================
IF MATypeV2 = 70 THEN
Period2 = MAX(Period2, 1)
IF BarIndex < Period2 THEN
AFRV2 = SeriesV2
ELSE
AFRV2 = Averagetruerange[Period2](Averagetruerange[Period2](Close))
ENDIF
ENDIF
IF MATypeV2 = 71 THEN
Period2 = MAX(Period2, 1)
IF BarIndex < Period2 THEN
AFRV2 = SeriesV2
ELSE
AFRV2 = Averagetruerange[Period2*2](Averagetruerange[Period2*2](Close))
ENDIF
ENDIF
IF MATypeV2 = 72 THEN
AFRV2 = Close
ENDIF
Another try:
Obviously more averages (then the 70 in the strategy) are thinkable, and could be added, I would add the close itself also.
Coded the Close itself below And
Averagetruerange[Period](Averagetruerange[Period](Close))
Averagetruerange[Period*2](Averagetruerange[Period*2](Close))
To be added for both MAType en MATypeV2, coded below
========FIRST AVERAGES AFR========================================
IF MAType = 70 THEN
Period = MAX(Period, 1)
IF BarIndex < Period THEN
AFR = Series
ELSE AFR = Averagetruerange[Period](Averagetruerange[Period](Close))
ENDIF
ENDIF
IF MAType = 71 THEN
Period = MAX(Period, 1)
IF BarIndex < Period THEN
AFR = Series ELSE AFR = Averagetruerange[Period*2](Averagetruerange[Period*2](Close)) ENDIF
ENDIF
IF MAType = 72 THEN
AFR = Close
ENDIF
========SECOND AVERAGES AFRV2=========================
IF MATypeV2 = 70 THEN
Period2 = MAX(Period2, 1)
IF BarIndex < Period2 THEN
AFRV2 = SeriesV2
ELSE AFRV2 = Averagetruerange[Period2](Averagetruerange[Period2](Close))
ENDIF
ENDIF
IF MATypeV2 = 71
THEN Period2 = MAX(Period2, 1)
IF BarIndex < Period2 THEN
AFRV2 = SeriesV2
ELSE AFRV2 = Averagetruerange[Period2*2](Averagetruerange[Period2*2](Close))
ENDIF
ENDIF
IF MATypeV2 = 72 THEN
AFRV2 = Close
ENDIF
Hi, thank you…now it works with prorealtime 10.3:-) I’d like test on EUR/USD…could you suggest a winning setup?
Just run the code for this pair, make sure you have the right spread filled.
What you could do is running it for 100.000 bars, without IS/OOS setting. With the something like 10 most profitable crossings, make a IS/OOS run (usually I choose 66% IS/34 OOS) (this can change the profitability significantly !) by selecting the outcome-ranges of the first and second averages from the presented (+/- 10) most profitable crossings.
Alternatively you could run an IS/OOS test run immediately on the 100.000 bars, but the disadvantage is that only 1 setting is presented as an optimum, not a range. I would like to see more seemingly profitable settings, that ‘s why I would like to start without IS/OOS first. But the IS/OOS testing is absolutely a necessary step in developing a (somewhere) robust trading strategy.
Hello. I understood that we were waiting to choose two values between 0 and 69 for the two variables, but I don’t understand how and where we should indicate these values. Thank you for your help.
EDIT : Ok I just understood. After adding the value: Once MAType = XXX
Once MATypeV2 = XXX you must save and relaunch the application.
Hi, Any way to project those 2 chosen averages (see below) on the chart?
“Once MAType = what you want to select
Once MATypeV2 = what you want to select”
Hi Roi Aglipa,
A bit late response on my site, Yes , you can project 2 averages, please find the indicator at https://www.prorealcode.com/topic/optimization-moving-average-crossing-strategy/ at page 12, as here I can not attach the ITF file.
import the ITF file, then you should be able to select the indicator with two MA types.
Hi Jan, tried to test this on Auto… but it’s coming up with an error? Is it possible to upload an Autotrader version without the “Once MAType”? Thanks.
Hi Adante79
I hope you have already found your answers
for autotrade, the variables has to be set fixed
like in the code somewhere at line 20
Once MAType = 15 that is one of the moving averages of 0-69
Once MATypev2 = 25 that is one of the second range of moving averages of 0-69
Propoer testing is necessary !! I have good experiences to avoid unexpected losses, in setting a strategy “live” in Demo for at least one month.
Also the variables on top ( var1 0-69 and var2 0-69), those variables are needed to determine the best crossing and are not in the code, has to be deleted for Auto Trading
It might be a good idea to reduce the average to 15 instead of 30 to reduce market noise effects, especially at higher timeframes. “To limit zigzagging of the averages due to market noise, an exponential average of 30 is added before the crossing condition is measured (Coded as wAFR = exponentialaverage[30](AFR) and wAFRv2 = exponentialaverage[30](AFRv2))”
Hello, Please can you help. I use 10.3 and are not able to set the strategy live.
“Folgende Veränderung müssen vor der Übermittlung des Codes an Proorder vorgenommen werden: Ersetzen Sie die Variable durch spezifische Werte. ( MA Type is set 10 & 30)
Thanks
Olli
Hi Jan, wondering i you can help please, can you let me know how i now implement the strategy the system has found please.
Great code by the way and would LOVE to talk to you more about it. Please let me know if we can chat about it more. But i am struggling to “Use” the strategy that i feel fits my portfolio and way.. Many thanks.
Hello Jan, thank you very much for this tremendous and huge work done.
It is really a fantastic time saving. After filtering here and there and adjusted to my creterias, it works properly. Thanks again for the time saving.
Bravo!
Fred
Hi Jan! In your opinion is it possible to set an instruction that every day, at a certain time f.e. 07am, automatically set the best value for the day?
Some late response of my site: same kind of question also asked in the beginning by MaoRai54,
Your idea is to quasi optimise the “best” crossing every day. Therefore you should also determine the period to be back-tested every day.
Please bear in mind that a short period with only a few trades is not very reliable, a different period with more trade may give completely different best crossings.
The main assumption is that the / a short last period gives the best guidance for short term future movements, which I tend to believe is true.
Program code concept could be as follows (not worked out yet), maybe the community gives excellent tips.
When time = 70000 then
Do for x bars backwards until now (period choosen for optimise crossing)
For Avg1 to Avg 67 do
For Avg21 to Avg2 67 do
determine trade result for the period, given the crossing
Next
Next
Select Avg and Avg2 which have given the best trade result
Run the av crossing trading algo with the daily selected best Avg and Avg2
Be aware that running this kinds of code could be (terrible) slow ! This is true if you test this, I have not yet tested it in a strategy.
Lots of discussion can be found at topic https://www.prorealcode.com/topic/machine-learning-in-proorder/
To activate it, I read that I have to remove the first 2 rows of code MATV1 and MATv2 …
I can’t figure out where I am and if I need to delete the whole row or replace with other parameters
Can you paste the code exactly by mentioning the line numbers?
Thanks
Sorry,
I found where I need to set MatV1 and 2
But to have it exactly identical to the BackTest with the 69 averages, how should I set it?
Thank you for that amazing program ! 🙂
bonsoir
comment faire les tests In Sample et Out of Sample.? je ne comprend pas le sens
I would be surprised if this is anything but datamining TBH but i will have a play and see what we find .
Hello Jan, thanks for your amazing work! 🙂
I have one question: How much data have you found to be most efficient for optimizing the model? 1 – 2 months or longer?
Jan, hello and congratulations!
This algo-strategy works wonderfully for time-frames longer than 5 minutes.
Help: How do I use it in “real trading mode” with ProRealTime version 11.1 for auto-trading?
Dear Jan,
Thanks for your great work.
I just tested the code and manage to follow the whole process except that I am blocked at this last step (as many of us it seems).
I use PRT V11.1.
Could you please let me know what has to be corrected in line 22 ? See attached picture for details
Many thanks for your support.
BR
Philippe
[url=https://postimg.cc/1fcBLjJj][img]https://i.postimg.cc/SNHPz08k/temp.png[/img][/url]
https://postimg.cc/1fcBLjJj
Found the needed correction, just send the 2 Defparam lines at the very begining of the code, then no more error.
https://ibb.co/SmhxqBp
Bonjour Filoutube, je suis également bloqué comme vous mais votre dernier lien de photo avec la solution ne fonctionne pas. Pourriez vous m’aider ? Merci bcp !
I have now played around with this strategy for a while and my gut feeling is that it suffers from over-optimization. If you evaluate all the possible combinations you will find many that give fantastic results, but none of them provided any meaningful robustness upon closer inspection. So, did any of you find any combination on any index/time frame that provided you with any robustness?
It is a very nice idea, I have taken so many ideas
Hi There.. It seems the TSL stop loss is not working.. it does not respond is that correct?
Per lasciare che la strategia venga eseguita (dopo aver importato il file):
Basta eliminare MAType e MATypeV2 ai parametri di ottimizzazione (direttamente sopra la prima riga del codice)
Quindi digitare il codice
Once MAType = ciò che si desidera selezionare
Once MATypeV2 = ciò che si desidera selezionare
Spero che ti aiuti.
Ho letto questo post e avendo lo stesso problema, chiedo dove si trova MAType e MATypeV2, io non riesco a trovarlo.
Grazie
Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a strategy optimization/improvement? THANKS
Hi Ian, hope you still use PRT and so you can read this post. I have tested a lot your work and i think it is a very good idea. So, i have tried to improve it modifying a little bit your work.
First of all i have Inserted some variables to make more easy the backtesting to find the best options for each financial instrument.
In detail, i have added the following:
1. MinLotti, MaxLotti,MultiplierLot, LotMngt – To automate a Lot calculation where if the last trade was in loss the next trade will have a Lot increased by the MultiplierLot. If the last trade was in gain, nothing happen.
2. The Time to start and close was substituted by 2 variable so, it is possible to find the better time frame for any kind of symbol, future, etc… and it is adaptabe to the various markets who open at different time.
Obviously for the point 1. i have added some code to make this strategy working fine.
I’m also working to make dinamic Period and Period2 but as you know PRT has limit on the number of possible combination so i’m trying to find a smart way and i want to raise a question to you.
Normally the cross between two or more MA is made using different period and if the period of the first MA is 10 (for example) we need at least a double period for the second MA. So i’m thinking to a mechanism that choose automatically Period2 based on Period so we could limitate the combinations.
What do you think ? Do you have another idea ?
In the meantime i would to share with you and the other friends my version of the script you create but in this interface it is not possible attach .itf files so, who want the code can contact me directly and i’ll send it immediately or if you wants, you can ask me the file and add it to your original thread.
My email is: alex.furlani@gmail.com
Let me know