SMA/EMA crossover strategy not working as I think it should

Forums ProRealTime English forum ProOrder support SMA/EMA crossover strategy not working as I think it should

Viewing 15 posts - 1 through 15 (of 17 total)
  • #161380

    Hey! I have written so much more advanced things than this so it is pretty embarrassing to write this, but part of my big code didn’t act like I wanted it and when I wrote out a sample and  it still didn’t work, it is just a normal MA crossover. The buy and sell don’t appear where they are supposed to.

    Please tell me what I have done wrong.

    I will attach the code and also a picture of the result.

     

    #161381

    The buy and sell don’t appear where they are supposed to.

    Code is good so it must be your expectations above that are misleading you?

    Attach a screenshot and explain more what you expecting?

    #161382

    Right I’m sorry, I tried, I’ll try again.

    #161384

    Try GRAPH = sma crosses over baseline in your Algo code … does it show a 1 / true at correct positions?

    #161385

    Essraw – I have given your topic a more meaningful title. Please try to use more descriptive titles on any future topics. 

    #161386

    Have you double checked whether your SMA and EMA indicators are both using close and not something else such as median price?

    #161387

    Thank you Vonasi, GraHal I don’t quite get what you mean.

    #161388

    GraHal is suggesting adding the line:

    ….to the bottom of your strategy. I imagine though that it will just show the same points of crossover as your strategy is opening and closing trades.

     

     

     

    #161389

    Oh I see, yeah I tested it now, it shows the same!

    #161390

    Yes they are all using close

    #161391

    Have you checked your SMA and EMA settings? Perhaps you have them averaging something different or a horizontal shift added so your indicators are showing something different to your strategy code?

    1 user thanked author for this post.
    #161393

    I have just done a quick test and can confirm that something is wrong. It appears to be trading when either close or high or low crosses the EMA. I will test further but there does seem to be some sort of bug.

    1 user thanked author for this post.
    #161395

    no, nothing like that

    #161397

    Yes it seems very weird! I have done a similar code a few weeks back and there was no problem!

    #161398

    It is a typo in your first two lines. Change it to this:

     

    2 users thanked author for this post.
Viewing 15 posts - 1 through 15 (of 17 total)

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