EMA crossover strategy fails to close positions

Forums ProRealTime English forum ProOrder support EMA crossover strategy fails to close positions

Viewing 5 posts - 1 through 5 (of 5 total)
  • #104198

    Hi,

    I have written a simple EMA crossover strategy which I am now forward testing in demo mode. It is in the market close to 100% of the time and goes long when fast EMA crosses over the slow and vice versa for short positions and long exits. The strategy code is pasted below. The problem I am having is that it seems to be failing to close positions. E.g. Over night last night on the Nasdaq it when short at the appropriate place but failed to close out the position this morning when the fast EMA crossed above the slow (see attached image).

    Does anyone have an idea as to why this is occurring and how it can be resolved?

    Thanks,

    Roj

     

     

     

    #104201

    Most likely because of the 3 minute time frame that you are using. If the chart that you show was started at a different minute to the minute that the strategy was started at then you will get a different chart. In fact you can get three different charts of the 3 minute time frame depending upon which of the three minutes that you start the chart on!

    #104207

    Have to ask (quicker than thinking as I have to go out) … is the reasoning above the same for, for example, the 5 min Chart??

    #104213

    Five minute chart candles are always at 0000 0005 0010 0015 etc but a three minute candle is constructed from whenever the chart or strategy starts. If could be 0000 or 0001 or 0002. The open at 0000 is different to that at 0001 and so we can instantly see that a different three minute candle will be drawn depending on the start time. The close is different too and you are plotting an average of it so it stands to reason that the two different start times will not have the same average returned.

    1 user thanked author for this post.
    #104215

    Thanks very much, I will try m5 or m1 and see how it goes. I chose m3 because it gave the best results in backtesting.

Viewing 5 posts - 1 through 5 (of 5 total)

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