Support Board
Date/Time: Sun, 24 Nov 2024 21:31:47 +0000
[User Discussion] - Trading System Based on Moving Average Crossover
View Count: 547
[2024-03-24 02:15:21] |
User643426 - Posts: 127 |
I'm working on creating an Automated Trading System based on the Moving Average Crossover Study. I'm using the Cross of the 9EMA above the 21 EMA as a Buy Entry. However, I only want the Buy Entry to occur when price is above VWAP. I would like the Buy Exit to occur on the close below the 9EMA. Conversely, the Sell Entry would be when the 9EMA crosses below the 21EMA but only when price is below VWAP and the Sell Exit would be when price closes above the 9EMA. Does anyone know how to do this? If I only wanted the Buy and Sell Entries to occur upon the cross of the 9EMA Above/Below the 21 EMA with the Moving Average Cross Over Study as ID1, is the formula below correct? If so, I'm not sure how to add the qualifier to only make the trade when Above/Below VWAP. Buy Entry: =AND(ID1.SG1>ID1.SG2,CROSSFROMBELOW(C,ID1.SG1)) Buy Exit: =C<ID1.SG1 Sell Entry: =AND(ID1.SG1<ID1.SG2,CROSSFROMABOVE(C,ID1.SG1)) Sell Exit: =C>ID1.SG1 |
[2024-03-24 17:42:55] |
Sawtooth - Posts: 4120 |
Try this: Buy Entry: =AND(CROSSFROMBELOW(ID1.SG1,ID1.SG2),C>ID2.SG1)) Buy Exit: =CROSSFROMABOVE(C,ID1.SG1) Sell Entry: =AND(CROSSFROMABOVE(ID1.SG1,ID1.SG2),C<ID2.SG1)) Sell Exit: =CROSSFROMBELOW(C,ID1.SG1) -where: ID1.SG1 is the 9EMA ID1.SG2 is the 21EMA ID2.SG1 is the VWAP |
[2024-03-25 01:09:43] |
User643426 - Posts: 127 |
Thank you so much! I really appreciate that. Yes, that worked but it's not a very profitable strategy as it only works about 25% of the time. It would be ideal to have the buy/sell entry occur after 1-2 pullback candles on the 5-minute chart that hold VWAP as support/resistance and then have the entry occur at the above/below the high/low of the last pullback candle. I'm sure it's very complicated but was wondering if it's possible to write a code for that. Thanks again:)
|
[2024-03-25 04:05:51] |
Sawtooth - Posts: 4120 |
I'm sure it's very complicated but was wondering if it's possible to write a code for that.
You can DM me.
|
[2024-03-25 23:23:42] |
User643426 - Posts: 127 |
I definitely will. I just sent a DM request.
|
[2024-10-27 05:56:35] |
User643426 - Posts: 127 |
Hi Tom, I just had a quick question about the Moving Average Crossover Trading System you helped me with a while ago. The system below is for a Buy Entry when the 9EMA crosses above the 21 EMA and when Price is above VWAP. This system only delivers a Buy Entry Signal when the 9EMA crosses above the 21EMA and price is already above VWAP. If the 9EMA crosses above the 21 EMA with price below VWAP but later price moves above VWAP, this system will not deliver a Buy Entry Signal. Do you know how I would write the code for the system to work when the 9EMA crosses above the 21EMA at one time with price below VWAP and then generates a BUY Entry signal at a later time when Price moves above VWAP (after the 9/21 EMA crossover occurred)? Thank you. Buy Entry: =AND(CROSSFROMBELOW(ID1.SG1,ID1.SG2),C>ID2.SG1)) Buy Exit: =CROSSFROMABOVE(C,ID1.SG1) Sell Entry: =AND(CROSSFROMABOVE(ID1.SG1,ID1.SG2),C<ID2.SG1)) Sell Exit: =CROSSFROMBELOW(C,ID1.SG1) -where: ID1.SG1 is the 9EMA ID1.SG2 is the 21EMA ID2.SG1 is the VWAP |
[2024-10-27 14:44:42] |
Sawtooth - Posts: 4120 |
You would need to create a persistent TRUE at the 9/21 cross, and then reference that in your entry signal. This is done using two IF statements, one to create the persistent TRUE, and another to release it. The 9/21 cross is the event to initiate it, and you'll need to use another event to release it, which could be the Buy exit, or something else. Use the Spreadsheet Formula study to create the persistent TRUE, like this for a Buy entry: =IF(CROSSFROMBELOW(ID1.SG1,ID1.SG2),1,IF(ReleaseCondition,0,ID3.SG1[-1])) where ID3 is this Spreadsheet Formula study. Then reference ID3 in your Buy entry formula: =AND(ID3.SG1=1,CROSSFROMBELOW(C,ID2.SG1)) Use another instance of the Spreadsheet Formula study for the Sell entry. Date Time Of Last Edit: 2024-10-27 14:45:09
|
[2024-10-27 15:06:43] |
User643426 - Posts: 127 |
Okay I understand. I've attached a screenshot of the study below
|
Attachment Deleted. Screenshot 2024-10-26 at 5.07.44 PM.png / V - Attached On 2024-10-27 15:05:24 UTC - Size: 1.33 MB - 17 views |
To post a message in this thread, you need to log in with your Sierra Chart account: