I would like to know how to code an exit from a trade based on a new lower low in the current trade.
For an ex then latest bar is lower than the last 30 bars then sell position
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Breakout strategy with new Higher high for go long and new lower low for go short
highh=highest[50](high)// when the price is higher than the last 50 bars i want to go long
lowl=lowest[30](low)// When the price is lower than the last 30 bars want to exit my long trade
Size=1//position size
Condlong=highh>close
Condexitlong=barindex-tradeindex(1)<=lowl // " Here is something wrong i can´t figure out how to get it right for exit ??? "
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