Suggestions on how to stop opening a trade against the trend

Forums ProRealTime English forum ProOrder support Suggestions on how to stop opening a trade against the trend

Viewing 8 posts - 1 through 8 (of 8 total)
  • #151255

    Hello All,

    Has anyone got any recommendations as to what kind of code could be used to stop trades been automatically opened when it’s against the prevailing trend?  The attached and circled trade is the example whereby my programme still executed a BUY long which was stopped out due but I’m kind of stuck on what would be a good means of validation?  I keep thinking something along the lines of ‘if average of the last 2 MA periods is lower than the average of the prior 3, do not trade’…..but no idea how I put that into code.  Ideas welcome!

     

     

    #151262

    Something like that? Not tested.

    You could just use- if ma[1]>ma[2]. This would be the simplest

    You could also experiment with Heikin ashi, macd and use of multi time frame. These might help you filter.

     

    #151275

    monochrome – Your code won’t work as you have not defined maofma.

    #151283

    Oops my bad. Meant  to be –

     

     

     

    #151347

    Interesting.  Thanks Monochrome!  Not sure how this works for multi time frame then?

    #151350

    Trend is pretty impossible to define. A trend in a 1 minute chart might be the opposite of a trend in a 5 minute chart which might be the opposite of a 1 hour chart which disagrees with a 4 hour chart which is opposite of a daily chart which goes the opposite direction to a weekly chart which disagrees with a monthly chart.

    Try to work out all these trends with a lagging moving average and you get lots of lagging opinions of direction of trend based on something that happened a while back – so isn’t actually current trend.

    Trying to define trend to use as a filter to avoid trades is a very difficult thing to do because one man’s monthly trend is the opposite to another man’s hourly trend and by the time you have decided it is a trend it is most likely reversing direction.

     

    #151351

    Trend direction is primarily given by (smoothed) moving averages.

    The upcoming end of a trend can be indicated early by the TRIX indicator : when TRIX changes color, a trend may weaken because momentum – as indicated by TRIX – decreases.

    The ADX indicator in combination with ADXR also shows whether a trend is still running or weakening. ADX > ADXR and ADX > ADX[1] means trend is still running and intact on a specific timescale. ADX < ADXR means no trend prevailing.

    Combination of all three indicators : MA, TRIX and ADX can give a good indication whether a trend is still intact. False signals included, as always.

    #151383

    I’m a great believer in Charles Dow’s idea of Primary, Secondary and Minor trends. Your execution is usually on the minor trend, as that is where the action is. The Primary and Secondary trends would be defined in relation to that. So if you were working on a daily chart, you might be looking at Monthly and Weekly  for your primary and secondary trends.

    At the 5m level as your minor trend, I find that a Secondary trend at 15m and Primary at 2h often works well. For scalping it might be 1m, 5m, 15m. It all depends on how long a game you want to play.

    There are lots of ways to identify trends at different TFs – Wilder’s Smoothing MA, SuperTrend, SAR etc etc. You have to play around and see what works best.

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

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