Is there a neat piece of code that defines trend by means of price bars making higher highs and higher lows?
In my trend breakout system which starts at ‘x’ hour I want PRT to check that the high at this time is the highest of the recent ‘n’ bars. So for example if my breakout system starts at 0800 I want PRT to check that if trend conditions are met, that it only initiates trade if the high is the highest high of the day since midnight. I had been using the code below but I think this could be wrong.
1
2
3
4
5
6
7
8
9
10
11
//set trend using highs and lows
Trend1=highest[1](high)
Trend2=highest[8](high)
Trend3=trend1-trend2
///
Trend4=lowest[1](low)
Trend5=lowest[8](low)
Trend6=trend4-trend5
Trend3>0
Trend6>-1
Rather than use EMAs I want price to define the trend, so is there also a way of saying only trade if price (on H1 for example) is making higher swing highs and higher swing lows (and vice versa for shorts)?
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue