Total Beginner
Forums › ProRealTime English forum › ProOrder support › Total Beginner
- This topic has 38 replies, 6 voices, and was last updated 3 years ago by
GraHal.
-
-
10/07/2022 at 3:27 AM #202041
Hi @Trader Sab
When I use your new code (Dow Jones, TF 5 min) it does exactly what it’s supposed to do:
He opens a long position when “Close Crosses Over indicator1”
He opens a short position when “Close Crosses Under indicator1”
The “Set Stop Trailing 10” works as it should.
The indicated times “FlatBefore / FlatAfter” also work well.
So, I don’t get random positions being opened?
The last comments about “C3 = True / 1” are based on a misunderstanding with GraHal.
GraHal tried to explain something completely different, namely the use of the “Graph” instruction.
Line 27 (with “True” or “1”) can be completely cancelled because line 29 already says “If c3 Then” and that is sufficient…
2 users thanked author for this post.
10/07/2022 at 9:20 AM #202048however I got a dismal result
It can happen, especially when using – close crosses under / over averages – which are notorious for optimisation to quickly turn from profit to loss.
In my version code / .itf I posted … try optimising a variable for the EA period (in place of period = 20) and you will see what I mean.
Let us know how you get on?
1 user thanked author for this post.
10/07/2022 at 10:06 AM #202051@GraHal
Good morning. Thank you so much for your encouraging words and all the support. I like the optimization you have on the code to make profit and stops more dynamic.
I tested both system this morning again and got the results below. I added the DEFPARAM flatbefore / after back into your code which did not improve the result.
I think I have to test it a bit longer to see more results. Compared to the codes you write this very simple and if it is going to work I’d be cuffed. 🙂
10/07/2022 at 10:18 AM #202062@GraHal
Just to show you what I mean, the code opened a long position at 11 am, where the condition of crossing over EMA20 was not given. I have to specify more clearly the signal but I am not sure how.
BTW sorry for the gazillion attachments in the last post, not sure how this happened.
10/07/2022 at 10:27 AM #202065If you post the code you are analysing above then I will try it on my platform and we can compare like with like.
1 user thanked author for this post.
10/07/2022 at 1:51 PM #202075@GraHal
I hope this works, not with the attachments. Thank you in advance for helping me out.
10/07/2022 at 2:38 PM #202078where the condition of crossing over EMA20 was not given
Your Buy entry condition (in EMA 20 SYSTEm DJI you posted) is NOT crossing over (as you say above); it is >= … see Line 8 below in your full code.
Also Set Stop Trailing 10 will never work on DJI … it will whipsaw you in and out of loads of trades and make an overall loss. Remove the TS for now, until you get the rest of the code understood / working.
1234567891011121314151617181920212223242526272829303132333435363738// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivatedDEFPARAM FLATBEFORE = 083000DEFPARAM FLATAFTER = 220000// Conditions to enter long positionsindicator1 = ExponentialAverage[20](close)c1 = (close >= indicator1[1])IF c1 THENBUY 0.5 CONTRACT AT MARKETENDIF// Conditions to exit long positionsindicator2 = ExponentialAverage[20](close)c2 = (close CROSSES UNDER indicator2[1])IF c2 THENSELL AT MARKETENDIFSET STOP TRAILING 10// Conditions to enter short positionsindicator1 = ExponentialAverage[20](close)c1 = (close <= indicator1[1])IF c1 THENSELLSHORT 0.5 CONTRACT AT MARKETENDIF// Conditions to exit short positionsindicator2 = ExponentialAverage[20](close)c2 = (close > indicator2)IF c2 THENEXITSHORT AT MARKETENDIFSET STOP TRAILING 1010/07/2022 at 3:34 PM #202081Remove the TS for now
Or optimise the TS value using min = 25, max = 250, step = 25
10/07/2022 at 5:03 PM #202085Work to the premise that your code will be working correctly and functioning as the code is written.
Have you tried / understood what to do with GRAPH yet? It is a way to show under the equity curve and positions if and when the GRAPH conditions are met.
So if you enter GRAPH C1 (just that, nothing more) at the bottom of your code I posted above, then click on backtest, you wll see an extra display appear which shows value = 1 for all bars where c1 = (close >= indicator1[1]).
-
AuthorPosts
Find exclusive trading pro-tools on