Total Beginner

Viewing 9 posts - 31 through 39 (of 39 total)
  • #202041
    JS

    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.
    #202048

    however 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.
    #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. 🙂

    #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.

    #202065

    If 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.
    #202075

    @GraHal

    I hope this works, not with the attachments. Thank you in advance for helping me out.

    #202078

    where 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.

     

    #202081

    Remove the TS for now

    Or optimise the TS value using min = 25, max = 250, step = 25

    #202085

    Work 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]).

     

Viewing 9 posts - 31 through 39 (of 39 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login