Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 10:52:00 +0000



[User Discussion] - Alert Code Assistance

View Count: 946

[2014-08-31 17:19:56]
OneMoreTick - Posts: 79
Can you please help with the code for this situation? I'd like to know when price makes a lower low or higher high outside of a moving average but only if price closes back within the moving average before making the lower low or higher high.

For example, on the attached picture, price moves below the moving average on bars 1 to 3. Price then closes back inside the moving average on bar 5 and then makes the lower low outside the moving average on bar 7. As soon as bar 7 is below bar 3 (the last swing low), that would activate the alert. But if price had not closed back within the moving average in between the swing lows, bar 7 would not qualify for an alert.

So the logic is like this:
1)On bar x, price closes under the moving average (in this case, bar 3 would qualify as bar x)
2)On any bar after bar x (we'll call this bar y), price closes above the moving average (in this case, bar 5 would qualify as bar y)
3)On any bar after bar y, price is under the moving average and under the last swing low (a close under the swing low isn't required)
imageSierra Study.jpg / V - Attached On 2014-08-31 17:17:56 UTC - Size: 21.98 KB - 318 views

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account