Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 04:16:19 +0000



[Programming Help] - help with custom indicator? Paintbar if candle closes inside the range of previous candle?

View Count: 1870

[2018-08-13 12:32:18]
User66360 - Posts: 81
Can anyone help me code this? I already use the inside bar indicator. I am also wanting to add a paint bar if the candle closes inside the range of the previous candle. Anyone know how to do this? Thanks
[2018-08-13 12:45:59]
infpz - Posts: 826
Try: AND(C>L[-1],C<H[-1]) in the Color Bar Based on Alert Condition Study.

This means the close of the current bar must be greater than the low of the prior bar and the close of the current bar must be less than the high of the prior bar.
[2018-08-13 16:54:26]
User66360 - Posts: 81
Its been a while since I've added a custom code. Can I get a refresher.
[2018-08-13 17:01:11]
infpz - Posts: 826
https://www.youtube.com/playlist?list=PLxnPJP62Qw4XcuChFBkoPRwx81lZUUmSV
[2018-08-14 13:22:47]
User66360 - Posts: 81
Thanks! Just what I was looking for.
[2018-08-17 13:24:35]
User66360 - Posts: 81
Can you help me out with another code very similar. I use a SMA 4 and SMA 7. If price closes above both it paints the bars green. If it closes below it paints the candles red. Thank you
[2018-08-17 13:32:40]
Xfanman1 - Posts: 320
=AND(C>ID4.SG1,C>ID7.SG1) where ID4 is your 4 SMA and ID7 is your 7 SMA for your Green Bar condition.

then another Color Bar Based on Alert Study for your Red Bar condition -->

=AND(C<ID4.SG1,C<ID7.SG1)

--
Scott
[2018-08-17 13:59:36]
User66360 - Posts: 81
I keep getting an error messages.
[2018-08-17 14:07:43]
Xfanman1 - Posts: 320
Did you substitute your SMA ID’s with the ones I used as an example?
[2018-08-17 14:15:25]
User66360 - Posts: 81
I only copy and pasted the code you gave into each color bar study. Is there another step?
[2018-08-17 14:22:42]
Xfanman1 - Posts: 320
Yes, you must substitute your SMA ID's with what I used in the code I provided. I have no idea what your SMA ID's are, they were only examples. Look in your chart study and see what the correct ID's are for your 4 SMA and your 7 SMA study. Replace the ID4.SG1 and ID7.SG1 with your correct study ID's. IDx represents the correct study and SGx represents the appropriate Subgraph component in that study. SG1 should be correct, but you'll have to identify the correct ID #.

--
Scott
[2018-08-17 14:42:32]
User66360 - Posts: 81
Perfect, just what I was looking for. thank you

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

Login

Login Page - Create Account