Day Trading System - Basic afl for customization an Implementation

#1
Here is the basic code for implementing a day trading system based on a setup in one of my older thread about one and and a half years back.

This is not a full implementation of the system but it is a starting point for developing the system. This code as it is presented here is very profitable generating 80-100 percent annually over the last 2 years. There were 30-40 trades a year. This is back tested on Nifty Future.

Code:
SetPositionSize(50,4);

newday=Day() != Ref(Day(), -1);
DayH = HighestSince(newday,H);
DayL = LowestSince(newday,L);

lngB1 = newday AND C > ValueWhen(newday, Ref(DayH,-1)) AND C > O AND (H-L) > ATR(20) AND (H-C)< (C-O) AND (O-L) < (C-O); 
lngB2 = BarsSince(newday) == 1 AND (H-L) < Ref(H-L,-1)*0.7 AND C <= Ref(H,-1) + ATR(20);
lngSetup = Ref(lngB1,-1) AND lngB2;
Buy = lngSetup;
Sell = TimeNum()>151500 ;

shB1 = newday AND C < ValueWhen(newday, Ref(DayL,-1)) AND C < O AND (H-L) > ATR(20) AND (C-L) < (O-C) AND (H-O) < (O-C); 
shB2 = BarsSince(newday) == 1 AND (H-L) < Ref(H-L,-1)*0.7 AND C >= Ref(L,-1)- ATR(20);
shSetup = Ref(shB1,-1) AND shB2;
Short = shSetup;
Cover = TimeNum()>151500 ;
Back test it with a 20 point SL, if SL not hit then exit is on the bar after 3:15.

Back test it at your end, you can use it as it is ore modify it for better results. Data quality is important because it uses the open tick of the day forms the most important logic.

The original setup was discussed here.

http://www.traderji.com/advanced-tr...-day-trading-strategy-seems-well-working.html
 
#2
What is the Time frame on which you have tested the code . . .
 
#5
An infrequent setup . . . there is a Long traded today on NF


Not checked the code to understand the strategy,but seems like

it is applicable only for gap days and trades only in the direction of the gap.


code for implementing stop and identifying the long and short setup days


Code:
ApplyStop(0,2,Optimize("SL Points", Param("SL Points", 20,10,100,5), 10,100, 5));	//Stop Loss
col = IIf(Ref(lngSetup,-BarsSince(newday)+1),ColorRGB(10,10,60),IIf(Ref(shSetup,-BarsSince(newday)+1),ColorRGB(60,10,10),ColorRGB(10,10,10)));
PlotOHLC(DayL,DayH,DayL,DayH,"",col,styleCloud|styleNoRescale|styleNoLabel);

:) Happy
 
#6
An infrequent setup . . . there is a Long traded today on NF


Not checked the code to understand the strategy,but seems like

it is applicable only for gap days and trades only in the direction of the gap.


code for implementing stop and identifying the long and short setup days


Code:
ApplyStop(0,2,Optimize("SL Points", Param("SL Points", 20,10,100,5), 10,100, 5));	//Stop Loss
col = IIf(Ref(lngSetup,-BarsSince(newday)+1),ColorRGB(10,10,60),IIf(Ref(shSetup,-BarsSince(newday)+1),ColorRGB(60,10,10),ColorRGB(10,10,10)));
PlotOHLC(DayL,DayH,DayL,DayH,"",col,styleCloud|styleNoRescale|styleNoLabel);

:) Happy
on average u get 3 trades a month, but some moths may not have a single trade, and some have 5/6 trades. Gap is not a necessary condition.
 
#7
on average u get 3 trades a month, but some moths may not have a single trade, and some have 5/6 trades.
Yes, today was 2nd trade on NF this month, first one was stopped out.

Have you tested it with other F&O scrips? If you can find few more scrips suitable for this setup, more opportunities to trade will be available.


:) Happy
 

Similar threads