Trading Price Rejections, Fakeouts

trader.trends

Well-Known Member
#1
We wait to trade the breakouts whether from ranges, channels, High/Lows etc. What happens when the break out occurs and then it fails? Does that give us a chance to trade? First we need to identify which failed breakouts (fakeouts) we will trade. Bandlab has created a system to trade the fakeouts of Nr7i. Here is a shot at trying the fakeouts of 2 day high/Low.

Entry Setup: Wait for the 2 day high/low to be broken. If it happens at the opening with a gap, wonderful. Once the 2D H/L is broken, next is to wait for the Previous close to be broken. When the Previous close is broken the trade is on. If the PC is broken after the 2D High is broken, we short the break of the PC, If the PC is broken after the 2D Low is broken, we go long.

Stops: For shorts, the 2D High, for Longs the 2D Low.

Exits: So far I have looked at only closing at LTP. May refine the exits later.

Position Size: Undecided, but for now paper trading with fixed cap of one lac on every trade.

Time frame: Intra day only. No carry over.

This is just a trade set up not a confirmed strategy. Back test of EOD data gives wonderful result but not reliable. Here are a few sample trades on 8 stocks I am tracking for this purpose. All trades not listed here.

5 Jan
Reliance broke the 2 day High(1096) at open itself. The open and high remained at 1149.90. Shorted the break of 1075.50(PC). LTP was 1068.70.
SBI broke 2DH (2300) at open. Shorted the break of 2291.20(PC). LTP: 2294
6 Jan
Infosys broke the 2DH of 2630 again at open. Shorted the break of 2621.35(PC). LTP: 2580
Bharti broke the 2DH of 332.10 at open. Shorted the break of 330.35(PC). LTP: 326.90

Refinements welcome.
 

bandlab2

Well-Known Member
#2
thanks TT,

I like such simple systems and also am a fan of failed break outs. here is a quick afl that i wrote, looks promising. but needs to observe in real time

one change i made, the take profit is modified as factor of stop loss, defaulted to 1, which means RRR is 1. its a parameter you ca change.

this afl also writes the trades to a csv file

Code:
///////////////////////////////////////////////////

// Author : Bandlab
// Designed by : trader.trends

// Entry Setup: Wait for the 2 Day High/Low to be broken. if it happens at the opening with a gap, wonderful. Once the 2D H/L is broken, next is to wait for the Previous Close to be broken. When the Previous Close is broken the trade is on. if the PC is broken after the 2D High is broken, we Short the break of the PC, if the PC is broken after the 2D Low is broken, we go long. 

// Stops: for shorts, the 2D High, for Longs the 2D Low.

// Exits: So far I have looked at only closing at LTP. May refine the exits later.

// Reference : http://www.traderji.com/day-trading/37029-trading-price-rejections-fakeouts.html

//////////////////////////////////////////////////



RiskAmount=Param("Risk Amount",500,50,10000,50);
Profitfactor=Param("TP/SL Ratio ",1,0.1,100,0.1);
RiskPercentMin=Param("Risk Percent Min",30,50,250,50);
RiskPercentMax=Param("Risk Percent Max",76,50,250,50);



PlotOHLC(Open,High,Low,Close,"",colorWhite,styleCandle);


Sell=   H > Ref(HHV(H,2),-1) AND C<Ref(C,-1); 
Buy=   L < Ref(LLV(L,2),-1) AND C>Ref(C,-1); 


BuyPrice = IIf(Buy, Ref(C,-1),0);
SellPrice = IIf(Sell, Ref(C,-1),0);

BuySL =  IIf(Ref(L,-1)==Ref(C,-1), L, Ref(LLV(L,2),-1));
BuyTP = BuyPrice + (BuyPrice - BuySL )*Profitfactor;
SellSL = IIf(Ref(H,-1) == Ref(C,-1), H, Ref(HHV(H,2),-1));
SellTP = SellPrice - (SellSL - SellPrice )*Profitfactor;

riskPercent = IIf(Buy, (BuyPrice - BuySL)*10000/BuyPrice , IIf(Sell, (SellSL-SellPrice )*10000/SellPrice ,0));
Buy=IIf(Buy AND riskPercent > RiskPercentMin AND riskPercent < RiskPercentMax, 1, 0);
Sell=IIf(Sell AND riskPercent > RiskPercentMin AND riskPercent < RiskPercentMax, 1, 0);


shape=Buy*shapeUpArrow+Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,colorGreen,colorRed),0,IIf(Buy,L,H)); 


//money management
lotSizeb = round((riskAmount/(BuyPrice-BuySL)));
lotSizes = round((riskAmount/(SellSL -SellPrice )));


Buystatus = IIf(Buy AND H>BuyTP , 1, 0);
Sellstatus = IIf(Sell AND L<sellTP , 1, 0);


if( Status("action") == actionIndicator ) 
(

Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}  Op %g, , Hi %g, Lo %g, Cl %g (%.1f%%) {{VALUES}}",  O,H, L,C, SelectedValue( ROC( C, 1 ) ) )+"\n"+EncodeColor(colorWhite)+ "2DLH Breakout System" + " - " +  Name() +  EncodeColor(colorWhite) +

 "\n" +EncodeColor(colorYellow) + WriteIf(((BuyPrice) ) , "Position Size :  "+( lotSizeb )+"  ","")+ WriteIf(((SellPrice ) ) , "Position Size :  "+( lotSizes )+"  ","")+
WriteIf((BuyPrice), "GO LONG :  "+( BuyPrice)+"  ","")+
WriteIf( BuyTP , "     -     LONG TP :  "+(BuyTP )+" ","")+
WriteIf(BuySL , "    -    LONG SL :  "+(BuySL ),"")+

"\n"+
EncodeColor(colorRed) +
WriteIf(SellPrice , "GO Short :  "+( SellPrice )+"  ","")+
WriteIf(SellTP , "    -    Short TP :  "+(SellTP ),"")+
WriteIf( SellSL , "     -     Short SL :  "+(SellSL )+" ",""));




//exploration
AddColumn( IIf(Buy, 66, IIf(Sell, 83,01 )), "GO", formatChar, colorWhite, bkcolor= IIf(Sell,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy , BuyPrice, IIf(Sell , SellPrice,01 )), "ENTRY@", 1.2, colorWhite, bkcolor= IIf(Sell,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy , BuyTP , IIf(Sell , SellTP ,01 )), "TP@", 1.2, colorWhite, bkcolor= IIf(Sell,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy , BuySL , IIf(Sell , SellSL ,01 )), "SL@", 1.2, colorWhite, bkcolor= IIf(Sell,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy , Buystatus , IIf(Sell , Sellstatus ,01 )), "Status@", 1.2, colorWhite, bkcolor= IIf(Sell,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy , Lotsizeb, IIf(Sell, Lotsizes,01 )), "QTY", 1.0, colorWhite, bkcolor= IIf(Sell,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy , riskPercent , IIf(Sell, riskPercent ,01 )), "Risk%", 1.0, colorWhite, bkcolor= IIf(Sell,colorDarkRed,colorDarkGreen) );



// csv file

if (IsEmpty(StaticVarGet("EntrySignal"+Name())))
{
	StaticVarSet("EntrySignal"+Name(), 1);
}




   if ((StaticVarGet("EntrySignal"+Name()) == 1) && LastValue( Buy )  )  {
		fh = fopen( "C:\\trades_buy_"+Name()+".csv", "awr"); 
		if( fh) 
		{ 
			fputs(Name()+","+Date()+","+BuyPrice+","+BuyTP+","+BuySL+","+ round(BuySL*0.9995*10)/10+","+lotSizeb, fh);
			StaticVarSet("EntrySignal"+Name() , 0); 			 
			fclose( fh );
		}
	} 

	

    
	if ((StaticVarGet("EntrySignal"+Name()) == 1) && LastValue( Sell)) {
      fh = fopen( "C:\\trades_sell_"+Name()+".csv", "awr"); 
      if( fh) 
		{
			fputs(Name()+","+Date()+","+SellPrice+","+SellTP+","+ SellSL+","+round(SellSL*1.0005*10)/10+","+lotSizes , fh);
			StaticVarSet("EntrySignal"+Name() , 0);
			fclose( fh );
		}
	}
 
  
  


Filter=Buy OR Sell;
 
Last edited:

bandlab2

Well-Known Member
#3
Stops: For shorts, the 2D High, for Longs the 2D Low.


this needs some modification. lets say prev day bar is 2 day high and closed at high. today, it went above yesterday high and started going down. here entry is at prev day high (also close) and also stoploss is same as entry price. in such case, we should take today's high as SL
 

trader.trends

Well-Known Member
#4
Stops: For shorts, the 2D High, for Longs the 2D Low.


this needs some modification. lets say prev day bar is 2 day high and closed at high. today, it went above yesterday high and started going down. here entry is at prev day high (also close) and also stoploss is same as entry price. in such case, we should take today's high as SL

That would be correct. If PC closes at 2Dh or 2DL, then the trades taken will have today's H/L as stops.
 

bandlab2

Well-Known Member
#5
tt,

i have modified the afl to consider the PC=PH , PC=PL situation. also sometimes difference between entry and SL is very very less or very very high. in both cases , the chances of hitting SL is high. i have parameterised this, if the percent is between 30 and 75, its giving good results. it eliminates some nioce
 

trader.trends

Well-Known Member
#6
tt,

i have modified the afl to consider the PC=PH , PC=PL situation. also sometimes difference between entry and SL is very very less or very very high. in both cases , the chances of hitting SL is high. i have parameterised this, if the percent is between 30 and 75, its giving good results. it eliminates some nioce
Bandlab
Thanks for the effort on AFL. Unfortunately I do not use Ami so cannot comment/help on that. I am sure it will be useful to those who use Ami. I trade only the Nifty and a couple of stocks, hence do it manually. Do report the outcome of using the AFL. I have done a backtest on NF for the past few years based on EOD data and it held a promise hence initiated the setup. This is complementary to my other strategy of trading NF: SAR at 2D high/low that I have posted in another thread. While that is a swing positional trade, this gives the intraday trades.
Appreciate your efforts.
 

bandlab2

Well-Known Member
#7
Bandlab
Thanks for the effort on AFL. Unfortunately I do not use Ami so cannot comment/help on that. I am sure it will be useful to those who use Ami. I trade only the Nifty and a couple of stocks, hence do it manually. Do report the outcome of using the AFL. I have done a backtest on NF for the past few years based on EOD data and it held a promise hence initiated the setup. This is complementary to my other strategy of trading NF: SAR at 2D high/low that I have posted in another thread. While that is a swing positional trade, this gives the intraday trades.
Appreciate your efforts.
hi tt, curious to know how did u do backtest ? yahoo gives only spot prices. also we need a intraday chart to see if it hit SL first or TP first. we need to do like this every day. its a very tedious task

i ran my afl for last 1 week on nifty stocks. the results are encouraging. but again we need to check each and every chart on intraday basis. but good thing is there are only 2-3 signals a day. after i put the min, max levels the noice is reduced and profitabality increased a lot

will start trading small amount from monday...
 

trader.trends

Well-Known Member
#8
hi tt, curious to know how did u do backtest ? yahoo gives only spot prices. also we need a intraday chart to see if it hit SL first or TP first. we need to do like this every day. its a very tedious task
I have the OLHC of NF for everyday with me from 2005 onwards, collected from NSE. Also data from Investbulls (1min). This will give you the broad picture. When in doubt pull up the inraday chart. I used Qtstalker on Ubuntu. Since I gave up Windows in my teens, I cannot use any software that needs Uncle Bill's support. Hence no Ami. It was a tedious task, in a way. But happy with the result and happier to share.

Look forward to your trades.
 

Similar threads