Support Board
Date/Time: Wed, 15 Jan 2025 16:03:07 +0000
Post From: Simple auto trading buy/sell crossover SMA
[2017-08-09 23:05:15] |
Sawtooth - Posts: 4152 |
Columns O, P and Q are for longs only. For short trades, you need to replicate columns O, P and Q. Use R, S, and T. You can still reference K1 in long and short formulas. isn't it suppose to sell Entry when it close above High SMA and Sell Exit when it close above the low SMA?
No, but your formula is correct, except you can't use column O if it is also used for longs.If you are using the inverse of the long formula, you want the sell entry to cross from above the higher SMA (ID2), and the sell exit to cross from below the lower SMA (ID3). Longs: O3: =IF(CROSSFROMBELOW(E3:E4,ID3.SG1@3:ID3.SG1@4),1,IF(CROSSFROMABOVE(E3:E4,ID2.SG1@3:ID2.SG1@4),0,O4)) P3: =IF(O3=0,0,IF(AND(O3,E3<ID3.SG1@3),P4+1,P4)) Q3: =IF(K3,1,IF(O3=0,0,Q4)) K3: =IF($K$1=0,AND(O4=0,O3),AND(O3>0,P4<$K$1,P3=$K$1)) L3: =AND(Q4,Q3=0) Shorts: R3: =IF(CROSSFROMABOVE(E3:E4,ID2.SG1@3:ID2.SG1@4),1,IF(CROSSFROMBELOW(E3:E4,ID3.SG1@3:ID3.SG1@4),0,R4)) S3: =IF(R3=0,0,IF(AND(R3,E3>ID2.SG1@3),S4+1,S4)) T3: =IF(M3,1,IF(R3=0,0,T4)) M3: =IF($K$1=0,AND(R4=0,R3),AND(R3>0,S4<$K$1,S3=$K$1)) N3: =AND(T4,T3=0) I changed K3 and M3 so you can use 0 in K1 for no offset. However, this will require setting Support Reversals to Yes. When K1 is >0, these formulas will sometimes give you consecutive longs or consecutive shorts because of the offset entries. |