SH's 315 Strategy - how to make it more comfortable and profitable!!

NTrader42

Well-Known Member
If EMA 45 (today) > EMA 45 (yesterday) > EMA 45 (day before yesterday), then buy..

If EMA 45 (today) < EMA 45 (yesterday) < EMA 45 (day before yesterday), then sell..

hmm.. dekhna padega.

Edit : But, maybe this will work better with Nifty spot, because 45days ago today's future prices may have been commanding serious premium... just a thought.

too much thinking not good :D

Can someone please give the formula for calculating 45EMA in excel ??
2nd link on google http://www.iexplain.org/ema-how-to-calculate/
 

VJAY

Well-Known Member
Hello

The above concept is very easy to test using amibroker and many different combination or twists can also be easily tested.

For e.g. if instead of 2 times up/down we consider 3 times, the profit increases to 2700 and number of trades reduce to 240.

This concept of using the direction of the slope of MA line to decide the long/short works very well with higher MA

For e.g. if we choose EMA45 we get just 102 trades with gain of 7291 points and win/loss of 40/62

List of Trades for ema45
Code:
Ticker	Trade	Date	Price	Ex. date	Ex. Price	% chg	Profit	% Profit	Contracts	Position value	Cum. Profit	# bars	Profit/bar	MAE	MFE	Scale In/Out	
NIFTY-I	Long	09/13/2000	1479.1	09/19/2000	1340	-9.40%	-139.10	-9.40%	1	1479.10	-139.10	5	-27.82	-9.40%	0.06%	0/0
NIFTY-I	Short	09/19/2000	1340	11/10/2000	1269	-5.30%	71.00	5.30%	1	1340.00	-68.10	38	1.87	-2.46%	19.55%	0/0
NIFTY-I	Long	11/10/2000	1269	11/14/2000	1219	-3.94%	-50.00	-3.94%	1	1269.00	-118.10	3	-16.67	-4.81%	0.00%	0/0
NIFTY-I	Short	11/14/2000	1219	11/29/2000	1274.9	4.59%	-55.90	-4.59%	1	1219.00	-174.00	12	-4.66	-4.59%	0.33%	0/0
NIFTY-I	Long	11/29/2000	1274.9	12/26/2000	1245	-2.35%	-29.90	-2.35%	1	1274.90	-203.90	19	-1.57	-7.37%	7.14%	0/0
NIFTY-I	Short	12/26/2000	1245	01/05/2001	1255	0.80%	-10.00	-0.80%	1	1245.00	-213.90	9	-1.11	-6.83%	2.81%	0/0
NIFTY-I	Long	01/05/2001	1255	02/27/2001	1323	5.42%	68.00	5.42%	1	1255.00	-145.90	37	1.84	0.00%	13.55%	0/0
NIFTY-I	Short	02/27/2001	1323	03/02/2001	1372.1	3.71%	-49.10	-3.71%	1	1323.00	-195.00	4	-12.27	-5.82%	2.27%	0/0
NIFTY-I	Long	03/02/2001	1372.1	03/07/2001	1302.05	-5.11%	-70.05	-5.11%	1	1372.10	-265.05	3	-23.35	-7.66%	1.45%	0/0
NIFTY-I	Short	03/07/2001	1302.05	05/25/2001	1169.9	-10.15%	132.15	10.15%	1	1302.05	-132.90	55	2.40	-0.99%	22.65%	0/0
NIFTY-I	Long	05/25/2001	1169.9	06/05/2001	1118.1	-4.43%	-51.80	-4.43%	1	1169.90	-184.70	8	-6.48	-4.43%	1.97%	0/0
NIFTY-I	Short	06/05/2001	1118.1	10/24/2001	992	-11.28%	126.10	11.28%	1	1118.10	-58.60	99	1.27	-1.82%	23.87%	0/0
NIFTY-I	Long	10/24/2001	992	10/31/2001	948.15	-4.42%	-43.85	-4.42%	1	992.00	-102.45	5	-8.77	-4.44%	0.20%	0/0
NIFTY-I	Short	10/31/2001	948.15	11/05/2001	978	3.15%	-29.85	-3.15%	1	948.15	-132.30	4	-7.46	-5.16%	0.28%	0/0
NIFTY-I	Long	11/05/2001	978	12/28/2001	1023	4.60%	45.00	4.60%	1	978.00	-87.30	36	1.25	-0.71%	14.92%	0/0
NIFTY-I	Short	12/28/2001	1023	01/01/2002	1062	3.81%	-39.00	-3.81%	1	1023.00	-126.30	3	-13.00	-4.24%	0.64%	0/0
NIFTY-I	Long	01/01/2002	1062	03/28/2002	1132	6.59%	70.00	6.59%	1	1062.00	-56.30	62	1.13	-1.51%	13.09%	0/0
NIFTY-I	Short	03/28/2002	1132	04/03/2002	1134	0.18%	-2.00	-0.18%	1	1132.00	-58.30	4	-0.50	-1.32%	0.35%	0/0
NIFTY-I	Long	04/03/2002	1134	04/10/2002	1134	0.00%	0.00	0.00%	1	1134.00	-58.30	6	0.00	-0.70%	1.14%	0/0
NIFTY-I	Short	04/10/2002	1134	04/12/2002	1140.55	0.58%	-6.55	-0.58%	1	1134.00	-64.85	3	-2.18	-1.39%	0.35%	0/0
NIFTY-I	Long	04/12/2002	1140.55	04/17/2002	1129.1	-1.00%	-11.45	-1.00%	1	1140.55	-76.30	4	-2.86	-1.36%	1.26%	0/0
NIFTY-I	Short	04/17/2002	1129.1	06/13/2002	1093.45	-3.16%	35.65	3.16%	1	1129.10	-40.65	41	0.87	-0.96%	9.01%	0/0
NIFTY-I	Long	06/13/2002	1093.45	06/17/2002	1088.35	-0.47%	-5.10	-0.47%	1	1093.45	-45.75	3	-1.70	-1.14%	0.14%	0/0
NIFTY-I	Short	06/17/2002	1088.35	07/10/2002	1079.5	-0.81%	8.85	0.81%	1	1088.35	-36.90	18	0.49	-0.66%	3.98%	0/0
NIFTY-I	Long	07/10/2002	1079.5	07/12/2002	1061	-1.71%	-18.50	-1.71%	1	1079.50	-55.40	3	-6.17	-1.85%	0.27%	0/0
NIFTY-I	Short	07/12/2002	1061	11/18/2002	990	-6.69%	71.00	6.69%	1	1061.00	15.60	86	0.83	-0.46%	12.81%	0/0
NIFTY-I	Long	11/18/2002	990	01/28/2003	1046.95	5.75%	56.95	5.75%	1	990.00	72.55	50	1.14	-0.18%	12.02%	0/0
NIFTY-I	Short	01/28/2003	1046.95	02/19/2003	1065.95	1.81%	-19.00	-1.81%	1	1046.95	53.55	16	-1.19	-1.91%	1.38%	0/0
NIFTY-I	Long	02/19/2003	1065.95	02/27/2003	1048.2	-1.67%	-17.75	-1.67%	1	1065.95	35.80	7	-2.54	-1.67%	1.02%	0/0
NIFTY-I	Short	02/27/2003	1048.2	03/04/2003	1061.1	1.23%	-12.90	-1.23%	1	1048.20	22.90	4	-3.22	-2.55%	0.16%	0/0
NIFTY-I	Long	03/04/2003	1061.1	03/06/2003	1046.5	-1.38%	-14.60	-1.38%	1	1061.10	8.30	3	-4.87	-2.25%	0.11%	0/0
NIFTY-I	Short	03/06/2003	1046.5	05/28/2003	977	-6.64%	69.50	6.64%	1	1046.50	77.80	56	1.24	-0.05%	11.99%	0/0
NIFTY-I	Long	05/28/2003	977	02/25/2004	1820	86.28%	843.00	86.28%	1	977.00	920.80	192	4.39	-0.14%	107.66%	0/0
NIFTY-I	Short	02/25/2004	1820	03/04/2004	1860	2.20%	-40.00	-2.20%	1	1820.00	880.80	6	-6.67	-2.61%	3.00%	0/0
NIFTY-I	Long	03/04/2004	1860	03/12/2004	1795.25	-3.48%	-64.75	-3.48%	1	1860.00	816.05	7	-9.25	-3.48%	1.70%	0/0
NIFTY-I	Short	03/12/2004	1795.25	04/05/2004	1835	2.21%	-39.75	-2.21%	1	1795.25	776.30	17	-2.34	-2.26%	6.68%	0/0
NIFTY-I	Long	04/05/2004	1835	04/29/2004	1811.1	-1.30%	-23.90	-1.30%	1	1835.00	752.40	17	-1.41	-2.02%	3.81%	0/0
NIFTY-I	Short	04/29/2004	1811.1	07/21/2004	1554.85	-14.15%	256.25	14.15%	1	1811.10	1008.65	60	4.27	-0.96%	30.50%	0/0
NIFTY-I	Long	07/21/2004	1554.85	08/24/2004	1582.15	1.76%	27.30	1.76%	1	1554.85	1035.95	25	1.09	-0.57%	6.73%	0/0
NIFTY-I	Short	08/24/2004	1582.15	08/26/2004	1604	1.38%	-21.85	-1.38%	1	1582.15	1014.10	3	-7.28	-1.38%	0.07%	0/0
NIFTY-I	Long	08/26/2004	1604	01/13/2005	1907.4	18.92%	303.40	18.92%	1	1604.00	1317.50	98	3.10	-0.87%	32.29%	0/0
NIFTY-I	Short	01/13/2005	1907.4	02/01/2005	2060.1	8.01%	-152.70	-8.01%	1	1907.40	1164.80	12	-12.72	-8.01%	0.79%	0/0
NIFTY-I	Long	02/01/2005	2060.1	03/24/2005	2022	-1.85%	-38.10	-1.85%	1	2060.10	1126.70	38	-1.00	-4.62%	5.40%	0/0
NIFTY-I	Short	03/24/2005	2022	05/24/2005	2015.15	-0.34%	6.85	0.34%	1	2022.00	1133.55	42	0.16	-2.12%	7.17%	0/0
NIFTY-I	Long	05/24/2005	2015.15	10/20/2005	2430.15	20.59%	415.00	20.59%	1	2015.15	1548.55	105	3.95	-0.52%	32.33%	0/0
NIFTY-I	Short	10/20/2005	2430.15	11/09/2005	2494.4	2.64%	-64.25	-2.64%	1	2430.15	1484.30	13	-4.94	-2.74%	5.77%	0/0
NIFTY-I	Long	11/09/2005	2494.4	05/22/2006	3262	30.77%	767.60	30.77%	1	2494.40	2251.90	132	5.82	-1.22%	50.82%	0/0
NIFTY-I	Short	05/22/2006	3262	07/04/2006	3150	-3.43%	112.00	3.43%	1	3262.00	2363.90	33	3.39	-0.25%	21.06%	0/0
NIFTY-I	Long	07/04/2006	3150	07/19/2006	3025	-3.97%	-125.00	-3.97%	1	3150.00	2238.90	12	-10.42	-6.62%	3.43%	0/0
NIFTY-I	Short	07/19/2006	3025	07/28/2006	3139	3.77%	-114.00	-3.77%	1	3025.00	2124.90	8	-14.25	-4.49%	5.06%	0/0
NIFTY-I	Long	07/28/2006	3139	12/14/2006	3777	20.32%	638.00	20.32%	1	3139.00	2762.90	97	6.58	-2.00%	28.41%	0/0
NIFTY-I	Short	12/14/2006	3777	12/18/2006	3850	1.93%	-73.00	-1.93%	1	3777.00	2689.90	3	-24.33	-3.12%	0.29%	0/0
NIFTY-I	Long	12/18/2006	3850	12/21/2006	3790	-1.56%	-60.00	-1.56%	1	3850.00	2629.90	4	-15.00	-2.23%	2.29%	0/0
NIFTY-I	Short	12/21/2006	3790	12/27/2006	3957	4.41%	-167.00	-4.41%	1	3790.00	2462.90	4	-41.75	-4.41%	1.09%	0/0
NIFTY-I	Long	12/27/2006	3957	02/26/2007	3920	-0.94%	-37.00	-0.94%	1	3957.00	2425.90	40	-0.93	-3.64%	7.15%	0/0
NIFTY-I	Short	02/26/2007	3920	03/26/2007	3872.2	-1.22%	47.80	1.22%	1	3920.00	2473.70	21	2.28	-1.28%	10.33%	0/0
NIFTY-I	Long	03/26/2007	3872.2	03/29/2007	3780.1	-2.38%	-92.10	-2.38%	1	3872.20	2381.60	3	-30.70	-2.97%	0.36%	0/0
NIFTY-I	Short	03/29/2007	3780.1	04/11/2007	3830	1.32%	-49.90	-1.32%	1	3780.10	2331.70	9	-5.54	-1.53%	5.15%	0/0
NIFTY-I	Long	04/11/2007	3830	08/03/2007	4347.7	13.52%	517.70	13.52%	1	3830.00	2849.40	81	6.39	-1.20%	21.04%	0/0
NIFTY-I	Short	08/03/2007	4347.7	08/10/2007	4244.4	-2.38%	103.30	2.38%	1	4347.70	2952.70	6	17.22	-3.59%	2.38%	0/0
NIFTY-I	Long	08/10/2007	4244.4	08/17/2007	4086	-3.73%	-158.40	-3.73%	1	4244.40	2794.30	5	-31.68	-4.01%	2.99%	0/0
NIFTY-I	Short	08/17/2007	4086	08/29/2007	4244	3.87%	-158.00	-3.87%	1	4086.00	2636.30	9	-17.56	-5.69%	3.26%	0/0
NIFTY-I	Long	08/29/2007	4244	01/18/2008	5862	38.12%	1618.00	38.12%	1	4244.00	4254.30	100	16.18	-0.33%	49.29%	0/0
NIFTY-I	Short	01/18/2008	5862	04/22/2008	5015	-14.45%	847.00	14.45%	1	5862.00	5101.30	63	13.44	-1.12%	24.60%	0/0
NIFTY-I	Long	04/22/2008	5015	05/15/2008	5035	0.40%	20.00	0.40%	1	5015.00	5121.30	17	1.18	-1.83%	5.12%	0/0
NIFTY-I	Short	05/15/2008	5035	05/20/2008	5111.7	1.52%	-76.70	-1.52%	1	5035.00	5044.60	3	-25.57	-2.64%	0.00%	0/0
NIFTY-I	Long	05/20/2008	5111.7	05/26/2008	4916.65	-3.82%	-195.05	-3.82%	1	5111.70	4849.55	5	-39.01	-3.82%	0.67%	0/0
NIFTY-I	Short	05/26/2008	4916.65	07/25/2008	4347.7	-11.57%	568.95	11.57%	1	4916.65	5418.50	45	12.64	-0.86%	23.50%	0/0
NIFTY-I	Long	07/25/2008	4347.7	08/25/2008	4386	0.88%	38.30	0.88%	1	4347.70	5456.80	21	1.82	-4.27%	7.05%	0/0
NIFTY-I	Short	08/25/2008	4386	09/05/2008	4360	-0.59%	26.00	0.59%	1	4386.00	5482.80	9	2.89	-3.60%	4.06%	0/0
NIFTY-I	Long	09/05/2008	4360	09/15/2008	4092.5	-6.14%	-267.50	-6.14%	1	4360.00	5215.30	7	-38.21	-6.14%	4.68%	0/0
NIFTY-I	Short	09/15/2008	4092.5	12/22/2008	3064.9	-25.11%	1027.60	25.11%	1	4092.50	6242.90	65	15.81	-5.68%	45.56%	0/0
NIFTY-I	Long	12/22/2008	3064.9	12/26/2008	2973.4	-2.99%	-91.50	-2.99%	1	3064.90	6151.40	4	-22.88	-5.23%	1.73%	0/0
NIFTY-I	Short	12/26/2008	2973.4	01/05/2009	3087	3.82%	-113.60	-3.82%	1	2973.40	6037.80	7	-16.23	-3.99%	5.26%	0/0
NIFTY-I	Long	01/05/2009	3087	01/12/2009	2850	-7.68%	-237.00	-7.68%	1	3087.00	5800.80	5	-47.40	-9.16%	1.98%	0/0
NIFTY-I	Short	01/12/2009	2850	02/11/2009	2876.55	0.93%	-26.55	-0.93%	1	2850.00	5774.25	22	-1.21	-3.47%	7.53%	0/0
NIFTY-I	Long	02/11/2009	2876.55	02/18/2009	2729.9	-5.10%	-146.65	-5.10%	1	2876.55	5627.60	6	-24.44	-5.10%	3.39%	0/0
NIFTY-I	Short	02/18/2009	2729.9	03/20/2009	2791.3	2.25%	-61.40	-2.25%	1	2729.90	5566.20	20	-3.07	-6.79%	7.50%	0/0
NIFTY-I	Long	03/20/2009	2791.3	07/10/2009	4095.05	46.71%	1303.75	46.71%	1	2791.30	6869.95	75	17.38	-0.94%	68.51%	0/0
NIFTY-I	Short	07/10/2009	4095.05	07/17/2009	4265.6	4.16%	-170.55	-4.16%	1	4095.05	6699.40	6	-28.43	-4.79%	4.62%	0/0
NIFTY-I	Long	07/17/2009	4265.6	10/29/2009	4769	11.80%	503.40	11.80%	1	4265.60	7202.80	71	7.09	-0.22%	21.17%	0/0
NIFTY-I	Short	10/29/2009	4769	11/11/2009	4887.15	2.48%	-118.15	-2.48%	1	4769.00	7084.65	9	-13.13	-3.74%	4.98%	0/0
NIFTY-I	Long	11/11/2009	4887.15	12/22/2009	4967.1	1.64%	79.95	1.64%	1	4887.15	7164.60	30	2.67	-1.76%	6.23%	0/0
NIFTY-I	Short	12/22/2009	4967.1	12/29/2009	5191.05	4.51%	-223.95	-4.51%	1	4967.10	6940.65	4	-55.99	-4.89%	0.00%	0/0
NIFTY-I	Long	12/29/2009	5191.05	01/25/2010	4996	-3.76%	-195.05	-3.76%	1	5191.05	6745.60	19	-10.27	-4.72%	2.16%	0/0
NIFTY-I	Short	01/25/2010	4996	03/04/2010	5072	1.52%	-76.00	-1.52%	1	4996.00	6669.60	27	-2.81	-1.86%	6.58%	0/0
NIFTY-I	Long	03/04/2010	5072	05/06/2010	5112.35	0.80%	40.35	0.80%	1	5072.00	6709.95	43	0.94	-0.43%	6.43%	0/0
NIFTY-I	Short	05/06/2010	5112.35	06/07/2010	5011.35	-1.98%	101.00	1.98%	1	5112.35	6810.95	23	4.39	-2.07%	6.37%	0/0
NIFTY-I	Long	06/07/2010	5011.35	06/09/2010	5053.1	0.83%	41.75	0.83%	1	5011.35	6852.70	3	13.92	-1.47%	0.86%	0/0
NIFTY-I	Short	06/09/2010	5053.1	06/14/2010	5138.25	1.69%	-85.15	-1.69%	1	5053.10	6767.55	4	-21.29	-1.69%	1.98%	0/0
NIFTY-I	Long	06/14/2010	5138.25	11/19/2010	6012.65	17.02%	874.40	17.02%	1	5138.25	7641.95	113	7.74	0.00%	23.56%	0/0
NIFTY-I	Short	11/19/2010	6012.65	12/06/2010	6035	0.37%	-22.35	-0.37%	1	6012.65	7619.60	12	-1.86	-0.44%	4.75%	0/0
NIFTY-I	Long	12/06/2010	6035	12/10/2010	5765	-4.47%	-270.00	-4.47%	1	6035.00	7349.60	5	-54.00	-4.61%	0.98%	0/0
NIFTY-I	Short	12/10/2010	5765	12/23/2010	6006.5	4.19%	-241.50	-4.19%	1	5765.00	7108.10	9	-26.83	-4.82%	0.29%	0/0
NIFTY-I	Long	12/23/2010	6006.5	01/11/2011	5774.25	-3.87%	-232.25	-3.87%	1	6006.50	6875.85	14	-16.59	-4.34%	3.39%	0/0
NIFTY-I	Short	01/11/2011	5774.25	03/28/2011	5670.35	-1.80%	103.90	1.80%	1	5774.25	6979.75	53	1.96	-1.92%	10.38%	0/0
NIFTY-I	Long	03/28/2011	5670.35	05/04/2011	5541.3	-2.28%	-129.05	-2.28%	1	5670.35	6850.70	25	-5.16	-4.88%	5.81%	0/0
NIFTY-I	Short	05/04/2011	5541.3	06/29/2011	5565	0.43%	-23.70	-0.43%	1	5541.30	6827.00	41	-0.58	-1.47%	6.48%	0/0
NIFTY-I	Long	06/29/2011	5565	07/29/2011	5479.9	-1.53%	-85.10	-1.53%	1	5565.00	6741.90	23	-3.70	-1.65%	3.50%	0/0
NIFTY-I	Short	07/29/2011	5479.9	10/14/2011	5060	-7.66%	419.90	7.66%	1	5479.90	7161.80	51	8.23	-1.41%	13.90%	0/0
NIFTY-I	Long	10/14/2011	5060	11/17/2011	5052	-0.16%	-8.00	-0.16%	1	5060.00	7153.80	22	-0.36	-1.24%	6.77%	0/0
NIFTY-I	Open Short	11/17/2011	5052	11/18/2011	4914.6	-2.72%	137.40	2.72%	1	5052.00	7291.20	3	45.80	0.00%	4.09%	0/0

Grt works Ntrader,,,,,:thumb::clapping:
 

VJAY

Well-Known Member
Dear Ntrader,
Can you please share the afl for the same...am dumb about afl programmes...:)
 

rkkarnani

Well-Known Member
there can be diff in ema values for futures in every start of month. it depends on how calculation have done.

if calculation are on ohlc values for all those years then calculate, it will give continuous ema values, having no gap at the end of month.

if we are doing calculation for every series(t) differently, and keeping the data for current month only, then in start of every month there is a difference in 3ema as it's calculation not having last series(t-1) ema & ohlc.

another possibility of diff is for calculating ema we need last ema. so if software/excel at start take sma for first few. in that backtest intial data was from 14 may, 2007.

basically, i dont have another data to compare. plz share your data for ema's with ohlc if possible. so, i will be able to compare & will backtest other suggestion's on that data.

thanks.
In the very initial stages of the Excel sheet you posted I found a few "dates" are missing!! And these have created the difference in EMA vlaues!!
Even if the start value is not accurate but after 15 days data we should get the current values of 15EMA as correct!! I had posted a link to a file uploaded.. that has data OHLC and ema values as per the data I have!! Do have look!!
 

vikrit

Well-Known Member
Dear Ntrader42 & vikrit,

Thanks for the analysis done with various improvements. Both of you have done a good job and added diff colours to the 315 Strategy.

This is what i was saying. We need to keep on backtesting the suggested improvements over the basic 315 Strategy.

Vikirt - You have published what i have in my mind. But it is slightly adding to the confusion. To make it more clear can you mention the rules that you have followed while performing the backtesting?


for 315- i just used crossover, that's why mention actual profit will more when applied subjective rules. i will try to test with 3ema touch & add thing after some days b/c it will take more time., then post.

3ema suggestion (1st one with 15ema) main entry & exit on crossover and after that exit & enter when 2 consecutive 3ema down/up, again exit & enter(original direction) when 3ema go up/down.


3ema suggestion (1st one with 15ema) with filter- in this just added a filter of 9 point to exit and enter on 3ema move, else as above.

exit only - main entry on crossover and after that exit when 2 consecutive 3ema down/up, no reentry. if didnt exit happen before crossover then exit & entry on crossover. in this included entry if 3ema touch 15ema or not but dont cross and move again towards crossover entry.

exit only with filter- just added a filter of 9 in movement of 3ema.else as above.
 
Last edited:

vikrit

Well-Known Member
In the very initial stages of the Excel sheet you posted I found a few "dates" are missing!! And these have created the difference in EMA vlaues!!
Even if the start value is not accurate but after 15 days data we should get the current values of 15EMA as correct!! I had posted a link to a file uploaded.. that has data OHLC and ema values as per the data I have!! Do have look!!
yeah, you are right!. some dates missing in jun month, now got it.

thanks for data and specially for finding the problem and reason.:):thumb:
 

trade4joisar

Well-Known Member
I was looking @ few other strategy for supporting 315 & found one good way.

I have added DMA (Displaced Moving Average) with following values
period = 3
Displacement = 3

So whenever 3 EMA crosses DMA, it means now its time kiss 15 EMA. I know there is no 100% results but atleast we will get some help to increase profit with 315 strategy.



Uploaded with ImageShack.us

Let me know your views.
 

NTrader42

Well-Known Member
hello Vijay

The code for ema45

Code:
ema45	=	EMA(C, 45);
Buy	=	ema45 > Ref(ema45,-1) AND Ref(ema45,-1) > Ref(ema45,-2);
Sell	=	ema45 < Ref(ema45,-1) AND Ref(ema45,-1) < Ref(ema45,-2); 
Buy	=	ExRem(Buy,Sell);
Sell	=	ExRem(Sell,Buy);
SetPositionSize(1,4);
@T4j

using displaced ema just highlights the turn on ema3, essentially it is the same rule as proposed by SH for exit on getting an adverse turn on ema3

Thanks
 

Similar threads