Login Page - Create Account

Support Board


Date/Time: Sat, 20 Apr 2024 02:58:48 +0000



[Programming Help] - How to code if price is within 6 tics of a moving average

View Count: 956

[2019-09-09 19:28:36]
User116135 - Posts: 9
I want to be able to code when price (E3) is within 6 tics above let's say a 100 SMA (ID3.SG1) after a MACD cross to the upside. I have
=AND(CROSSFROMBELOW(AA3:AA5,AB3:AB5),E3>ID3.SG1@3
. What would I put to only take a trade if price is only within 6 tics above the SMA?

Thanks in advance for your assistance....
Date Time Of Last Edit: 2019-09-09 19:30:03
[2019-09-09 20:08:46]
Sawtooth - Posts: 3976
Try this:
=AND(E4<ID3.SG1@4+$J$21*6,E3>ID3.SG1@3+$J$21*6)

Note: This formula does not reference the MACD.
[2019-09-09 20:45:54]
User116135 - Posts: 9
Trade taken at 17 tics above the green ma. What am i missing?

=OR(AND(CROSSFROMBELOW(AA3:AA5,AB3:AB5),AO3>AR3,E3>ID3.SG1@3,ID4.SG1@3>0,ID6.SG1@3<50),AND(CROSSFROMBELOW(AO3:AO5,AR3:AR5),AA3>AB3,E3>ID3.SG1@3,ID4.SG1@3>0,ID6.SG1@3<50,AND(E4<ID3.SG1@4+$J$21*6,E3>ID3.SG1@3+$J$21*6)))

[2019-09-09 20:56:40]
User116135 - Posts: 9
What I am trying to accomplish:

********** IF MACD AND RSI ARE UP-SLOPING AND MACD ON 30 MIN CHART IS ABOVE ZERO AND RSI IS LESS THAN 50 AND PRICE IS ABOVE THE 144 MA AND PRICE IS WITHIN 6 TICS OF THE 144 MA
[2019-09-09 23:16:10]
Sawtooth - Posts: 3976
You haven't provided enough specific information for me to write the formula you need.

What I know:
- 144MA is ID3.SG1
- RSI is ID6.SG1

What I don't know:
- What is the ID#.SG# of the MACD?
- What study is ID4.SG1?
- What study is in columns AA and AB and what are their ID#.SG# numbers?
- What study is are in columns AO and AR and what are their ID#.SG# numbers?
- Must the MACD have also crossed its MA?
- Must the RSI have also crossed its MA?
- Is this formula used on a 30 min chart, or is there another MACD overlaid from a 30 min chart? If the latter, what is ID# of the Study/Price Overlay study?
- Do you want a signal the first time any of these conditions become TRUE, if all of the other conditions are already TRUE? Or is there one or more of these conditions that has precedence over the other conditions? IOW, which transitions should be the signal?
[2019-09-10 02:08:04]
Sawtooth - Posts: 3976
This is more complex than a simple formula example could provide here in the forum.

Please contact me here:
https://www.sawtoothtrade.com/contact.html
[2019-09-10 17:14:03]
User116135 - Posts: 9
Tom, I did email you at the contact you provided...
Thx

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

Login

Login Page - Create Account