Mk simple 3-80 Intraday Swing Strategy

mrkanitkar

Well-Known Member
#1
Here is thought process.
1. Use of fast and slow moving avg cross over
2. Use of volume info.
3. Use of tight SL
4. Use of target profit stops
5. Strategy should return profits after all brokerage+ taxes on monthly basis.
6. Use of TF 5, 15 min.

Rules:
1. Use simple moving avg of 3 as fast moving avg.
2. Use simple moving avg of 80 as slow moving avg.
3. SL should be 10
4. Profit target can be 20,30-60 (best found).
5. TF should be 5 Min or 15 min, 60 min, best results are in 5 min. (you will get better results in 1 min but then brokerage + taxes will be overhead due to more no. of trades).
6. This is start stop strategy. means, it starts with one (or multiple lots) lot buy, two sell and so on.
7. The reason SMA 80 chosen as it gives best coverage of one day plus, 80*5=400 mins.
8. SMA to EMA does not give any great results.

Action:
1. BUY = SMA 3 > SMA 80 with Volume > last 5 bars
2. Sell + Short = SMA 3 < SMA 80 with Volume > last 5 bars
3. Short Cover = SMA 3 > SMA 80 with Volume > last 5 bars

I will post ready made formula and backtesting details soon.
 

mrkanitkar

Well-Known Member
#2
Amibroker formula
------------
one uses greater than
---------
Buy = MA( Close , 3 ) > MA( Close , 80 )
AND Volume > Ref( Volume , -5 );



/* ApplyStop(stopTypeLoss, stopModePercent, Optimize( "max. loss stop level", 10, 2, 30, 1 ), True ); */
/*BuyStop = ApplyStop(stopTypeLoss, stopModePoint, Optimize( "MK max. loss stop level", 10, 2, 30, 1 ), True );*/

Sell = MA( Close , 3 ) < MA( Close , 80 )
AND Volume > Ref( Volume , -5 );



/*OR (( Ref( Close , -1 )- Close) < -5);*/

Short = MA( Close , 3 ) < MA( Close , 80 )
AND Volume > Ref( Volume , -5 );



Cover = MA( Close , 3 ) > MA( Close , 80 )
AND Volume > Ref( Volume , -5 );
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-20);
PlotShapes(IIf(Sell==1, shapeHollowDownArrow, shapeNone), colorRed, 0,High, Offset=-20);
PlotShapes(IIf(Short==1, shapeDownArrow , shapeNone), colorRed, 0,Low, Offset=-50);
PlotShapes(IIf(Sell==1, shapeHollowUpArrow, shapeNone), colorGreen, 0,High, Offset=-50);


----
two uses crossover
----
fast = MA (C,3);
slow = MA (C,80);
Buy = Cross(fast, slow)
AND Volume > Ref( Volume , -5 );

/* ApplyStop(stopTypeLoss, stopModePercent, Optimize( "max. loss stop level", 10, 2, 30, 1 ), True ); */
/*BuyStop = ApplyStop(stopTypeLoss, stopModePoint, Optimize( "MK max. loss stop level", 10, 2, 30, 1 ), True );*/

Sell = Cross(slow, fast)
AND Volume > Ref( Volume , -5 );

/*OR (( Ref( Close , -1 )- Close) < -5);*/

Short = Cross(slow, fast)
AND Volume > Ref( Volume , -5 );

Cover = Cross(fast, slow)
AND Volume > Ref( Volume , -5 );


PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-20);
PlotShapes(IIf(Sell==1, shapeHollowDownArrow, shapeNone), colorRed, 0,High, Offset=-20);
PlotShapes(IIf(Short==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);
PlotShapes(IIf(Cover==1, shapeHollowUpArrow, shapeNone), colorGreen, 0,Low, Offset=-20);
------
Formula for NEST Pulse for automated trade
BUY
-----
SET MA1 = SimpleMovingAverage(CLOSE, 3)
SET MA2 = SimpleMovingAverage(CLOSE, 80)
CROSSOVER(MA1, MA2) = TRUE AND VOLUME > REF(VOLUME, 1)
-------
Sell
------
SET MA1 = SimpleMovingAverage(CLOSE, 3)
SET MA2 = SimpleMovingAverage(CLOSE, 80)
CROSSOVER(MA2, MA1) = TRUE AND VOLUME > REF(VOLUME, 1)
-------

Short
--------
SET MA1 = SimpleMovingAverage(CLOSE, 3)
SET MA2 = SimpleMovingAverage(CLOSE, 80)
CROSSOVER(MA2, MA1) = TRUE AND VOLUME > REF(VOLUME, 1)
------
Cover
------
SET MA1 = SimpleMovingAverage(CLOSE, 3)
SET MA2 = SimpleMovingAverage(CLOSE, 80)
CROSSOVER(MA1, MA2) = TRUE AND VOLUME > REF(VOLUME, 1)
------
Or use following.

For buy
---
(SMA(CLOSE,3) > SMA(CLOSE,80)) AND VOLUME > REF(VOLUME, 1)

For sell
---
(SMA(CLOSE,3) < SMA(CLOSE,80)) AND VOLUME > REF(VOLUME, 1)
--------

Drawback of crossover is in case of gaps, formula will not trigger Buy or Sell signal. In case of Nest Pulse, it will work.
---------
 

mrkanitkar

Well-Known Member
#3
Backtesting
1. Nifty- last 240 days ending May 11.

3-80sma long-shortvgreater - Backtest ReportStatistics | Charts | Trades |
Formula | Settings | Symbols

Statistics
All tradesLong tradesShort trades
Initial capital600000.00600000.00600000.00
Ending capital791032.50691662.50699370.00
Net Profit191032.5091662.5099370.00
Net Profit %31.84 %15.28 %16.56 %
Exposure %75.09 %38.64 %36.45 %
Net Risk Adjusted Return %42.40 %39.54 %45.43 %
Annual Return %52.52 %24.25 %26.37 %
Risk Adjusted Return %69.94 %62.76 %72.34 %



All trades274137 (50.00 %)137 (50.00 %)
Avg. Profit/Loss697.20669.07725.33
Avg. Profit/Loss %0.14 %0.13 %0.14 %
Avg. Bars Held43.2844.5542.01



Winners91 (33.21 %)46 (16.79 %)45 (16.42 %)
Total Profit551745.00270312.50281432.50
Avg. Profit6063.135876.366254.06
Avg. Profit %1.15 %1.11 %1.20 %
Avg. Bars Held91.4792.4190.51
Max. Consecutive433
Largest win21740.0019835.0021740.00
# bars in largest win163127163



Losers183 (66.79 %)91 (33.21 %)92 (33.58 %)
Total Loss-360712.50-178650.00-182062.50
Avg. Loss-1971.11-1963.19-1978.94
Avg. Loss %-0.37 %-0.36 %-0.37 %
Avg. Bars Held19.3220.3518.29
Max. Consecutive13714
Largest loss-12590.00-8572.50-12590.00
# bars in largest loss32632



Max. trade drawdown-14435.00-10657.50-14435.00
Max. trade % drawdown-3.02 %-1.54 %-3.02 %
Max. system drawdown-37795.00-30720.00-60287.50
Max. system % drawdown-5.19 %-4.71 %-8.73 %
Recovery Factor5.052.981.65
CAR/MaxDD10.135.153.02
RAR/MaxDD13.4913.338.29
Profit Factor1.531.511.55
Payoff Ratio3.082.993.16
Standard Error12151.2710504.6815211.37
Risk-Reward Ratio18.7014.994.58
Ulcer Index1.801.664.05
Ulcer Performance Index26.1311.375.17
Sharpe Ratio of trades2.602.562.65
K-Ratio0.03280.02630.0080

-------
2. Jan 3rd to May 11, 2012.
3-80sma long-shortvgreater - Backtest ReportStatistics | Charts | Trades |
Formula | Settings | Symbols

Statistics
All tradesLong tradesShort trades
Initial capital600000.00600000.00600000.00
Ending capital676025.00652905.00623120.00
Net Profit76025.0052905.0023120.00
Net Profit %12.67 %8.82 %3.85 %
Exposure %83.07 %45.50 %37.56 %
Net Risk Adjusted Return %15.25 %19.38 %10.26 %
Annual Return %39.79 %26.78 %11.20 %
Risk Adjusted Return %47.90 %58.85 %29.81 %



All trades16783 (49.70 %)84 (50.30 %)
Avg. Profit/Loss455.24637.41275.24
Avg. Profit/Loss %0.09 %0.13 %0.05 %
Avg. Bars Held39.4443.3135.61



Winners53 (31.74 %)28 (16.77 %)25 (14.97 %)
Total Profit260400.00147995.00112405.00
Avg. Profit4913.215285.544496.20
Avg. Profit %0.95 %1.03 %0.85 %
Avg. Bars Held86.5192.4679.84
Max. Consecutive433
Largest win21455.0018700.0021455.00
# bars in largest win234218234



Losers114 (68.26 %)55 (32.93 %)59 (35.33 %)
Total Loss-184375.00-95090.00-89285.00
Avg. Loss-1617.32-1728.91-1513.31
Avg. Loss %-0.31 %-0.33 %-0.29 %
Avg. Bars Held17.5518.2916.86
Max. Consecutive13614
Largest loss-7325.00-5425.00-7325.00
# bars in largest loss8278



Max. trade drawdown-12840.00-8360.00-12840.00
Max. trade % drawdown-2.38 %-1.54 %-2.38 %
Max. system drawdown-25450.00-23800.00-45675.00
Max. system % drawdown-3.92 %-3.58 %-7.56 %
Recovery Factor2.992.220.51
CAR/MaxDD10.147.471.48
RAR/MaxDD12.2116.433.94
Profit Factor1.411.561.26
Payoff Ratio3.043.062.97
Standard Error8466.058838.1912465.25
Risk-Reward Ratio21.6514.204.64
Ulcer Index1.681.343.57
Ulcer Performance Index20.4415.931.62
Sharpe Ratio of trades2.012.741.11
K-Ratio0.02780.01820.0059

-------
3. I tested it for Nifty data (5 min & 15 min) from June 2009 to May 2012, close to 54000 bars.
4. This works on stocks which are in any trends and highly liquid.
5. Backtesting results will differ on TF, SL, Profit stops, Brokerage.
6. Margin is calculated as 100%, leverage will have very good profits.
7. There are few whipsaw on overnight position in backtesting.
--------
Here is result on NEST Pulse.
--------
04/30/2012 10:55:00 AM LONG 5272
04/30/2012 02:05:00 PM SHORT 5249
04/30/2012 03:15:00 PM EXIT SHORT 5270
04/30/2012 03:30:00 PM LONG 5270
05-02-2012 13:15 EXIT LONG 5267.95
05-02-2012 13:20 SHORT 5257
05-07-2012 14:05 LONG 5042.4
05-07-2012 14:10 SHORT 5045.95
05-07-2012 14:15 LONG 5067.5
05-08-2012 13:05 EXIT LONG 5077
05-08-2012 13:15 SHORT 5065.95
05-10-2012 09:20 LONG 5004.45
05-10-2012 13:05 SHORT 5007
05-11-2012 13:45 EXIT SHORT 4955.35
05-11-2012 14:00 LONG 4955.7
05-11-2012 15:05 SHORT 4934.7
05/14/2012 09:35:00 AM EXIT SHORT 4944
05/14/2012 09:50:00 AM SHORT 4935.75
05/14/2012 10:00:00 AM EXIT SHORT 4940.9
05/14/2012 10:05:00 AM SHORT 4938
05/14/2012 10:15:00 AM LONG 4944.65
05/14/2012 11:15:00 AM SHORT 4935.7
05/15/2012 10:40:00 AM EXIT SHORT 4921.05
05/15/2012 11:10:00 AM LONG 4912.5
05/16/2012 09:20:00 AM EXIT LONG 4862.7
05/16/2012 09:35:00 AM SHORT 4858
05/16/2012 02:50:00 PM LONG 4865.4
05/16/2012 03:20:00 PM EXIT LONG 4851.9
05/16/2012 03:25:00 PM SHORT 4852.85
-----------
NEST data is 26 April to 16 May, 5 min.
Net profit=182.50 points.
Total profit=371.30 points.
Total loss= 188.80 points.
Total trades= 15
-----
 

mrkanitkar

Well-Known Member
#4
You mean for NEST Pulse script?
Buy alert is
(SMA(CLOSE,3) > SMA(CLOSE,80)) AND VOLUME > REF(VOLUME, 5) AND CLOSE > OPEN AND CLOSE > REF (CLOSE,1) AND CLOSE > PSAR(CLOSE, 0.02, 0.2)

Buy exit alert is
CROSSOVER(PSAR(CLOSE, 0.02, 0.2), CLOSE)
This is profit taking on Parabolic sar reversal. This worked very well for yesterday.
You can use
(SMA(CLOSE,3) < SMA(CLOSE,80)) AND VOLUME > REF(VOLUME, 5)

as regular signal with OR option, this will exit at signal level so if market goes up and comes down fast like it did yesterday in Nifty,(range bound limit on uppper side) this will give no profit, no loss or may be just loss if signal comes little late than buy price.

You can also use automatic trailing stop loss or profit taking concept.
CLOSE < Ref(CLOSE,1)
This gives exit of current close is less than last one.
Ref (CLOSE,1) - CLOSE > 7
Above will check price difference of current bar with last one and if price came down by 7 points, it will give exit signal. This is automatic trailing signal. It will check for every 1 min or 5 min/ 15 min depending on your settings.

Sell/ Short alert system
(SMA(CLOSE,3) < SMA(CLOSE,80)) AND VOLUME > REF(VOLUME, 5) AND CLOSE < OPEN AND CLOSE < REF (CLOSE,1) AND CLOSE < PSAR(CLOSE, 0.02, 0.2)

Sell/ Short exit/ cover alert
(SMA(CLOSE,3) > SMA(CLOSE,80)) AND VOLUME > REF(VOLUME, 5)

as regular signal.

Profit taking
CROSSOVER(PSAR( CLOSE, (CLOSE, 0.02, 0.2))

Or
CLOSE - Ref (CLOSE,1) > 7
----------------------
Let me know if you need any help.
 

Similar threads