Basically, I'm trying to call the status of the indicator, whether its a HL, HH, LL, LH, etc... The swing relation variable groups HL and HH togeter as +1 and LL and LH as -1. Anyway idea on how I can differentiate between the different swings individually?
DT = +3
HH = +2
HL = +1
LH = -1
LL = -2
DB = -3
Thanks again for the PAS indicator. It continues to be an invaluable addition to trading price action. One item of difference between the old version and this one is the absence of sound alerts which I'm trying to rectify using your suggested inclusions in the code in Post 210. The old sound alerts were very useful as I have 8 instruments firing off new swing sound alerts.
The problem I'm finding with these changes/suggested code however it is firing a sound alert/drawing an arrow (I've substituted the sound alert for a yellow arrow) at any swing position rather than HH/HL then HH etc (please see attached chart). You can see some arrows are HL/LH then an arrow. What I'd like to do is draw the arrow based on HH/HL above HH and LL LH below LL line it did before.
Aggressive v Conservative swing entries
A suggestion to the indicator which would be useful is the inclusion of an aggressive swing signal option. The attached chart is based on a 3 bar Gann drawing a new swing after 3 bars. The problem I'm finding with this signal is it is drawing the swing arrow after the last swing has been violated.
For example in the attached chart we see on the bottom statistic panel the LH followed by LL is 67.3% which is quite favorable. Now the average number of bars in the swing length section is 10 bars. If you look at the chart at 8.17 am it draws a down yellow arrow 8 bars down as soon as the last swing has been violated. This is good for conservative entries but can be a problem as the average swing length is 10 bars so you don't leave much to play with. It would be useful to have this draw the arrow after 3 bars as soon as the swing is formed leaving 7 bars to play with a risk of a 3 bars stop of 15 ticks . This also lines up perfectly with the 5 EMA delta in the chart below moving into negative territory right after the 3 bar swing is formed. By the time the old swing has been formed 8 bars down the average delta is around -150 which is a little late as well.
So I guess the question is how would one incorporate into your indicator a signal after 3 bars in on a LL/LH and HL and HH? In conjunction with delta you could then evaluate the strength of the swing and make a judgement call on whether order flow is supporting the likelihood of a swing violation.
This isn't possible with this version. You have to add public data series for the swing highs/lows in the PriceActionSwing indicator to get access of this series in other indicators/strategies.
You can change the code of the swing relation in the "Swing trend/- relation" region of the PriceActionSwing indicator. But I suggest that you add two data series each for highs and lows. As example you can use the swingRelation series.
The following 4 users say Thank You to dorschden for this post:
The suggested code was only for double tops and bottoms, so it's normal that every arrow is in the region of the last swing. To play a sound every time a new swing is found you have to add the following line in the CalcDnSwing/CalcUpSwing region within the if (!updateLow)/if (!updateHigh) block under the statistic statement.
Or in your case change the PlaySound statement to a drawArrow statement. If you want only an arrow after a specific swing sequence you have to check for this sequence first at this place and draw an arrow then.
The conservative swing is when the swing rules are all true. For standard swings the first point we know that it is a new down swing is when the low of the current bar is smaller than the last 6 bars (or whatever number you set swing size) or the last down swing is broken. To get an aggressive entry you can check for example whether the current bar is smaller than the last 4 bars. By the Gann calculation you can check whether 4 consecutive bars are down bars. Or to make it dynamic for every swing size you can use percent values for example if the 66% of the swing calculation is true, then enter.
To check for a conservative entry you can simple check after the swing calculation region the newLow and newHigh variables whether they are true. For aggressive entries with the Gann swing calculations you can compare the consecutiveBars value with the swingSize minus 33% of the swingSize.
And with the standard swing calculation you can check for aggressive entries with a simple for-loop. There are ways to increase the performance but this is the simplest way and normally you'll never notice any performance differences.
I didn't test any of this code snippets, but they should work, maybe you have to change them a little bit. There are other ways to get an aggressive entry, but this is a simple one and in most cases a useful one.
I hope this helps a little bit.
The following 7 users say Thank You to dorschden for this post:
Is there a chance to this indicator to identify swings of at least "x" pips ?
The bar colors (trend) would be determined by swings of X pips or more....
Is there any indicator to the NT which determine the swings by number of pips?