CCI based AFL

#1
I'm using CCI based trading which is showing me good result. I've tested it with manual in excel and it is showing me 73% accuracy with proper SL and Target.

If anybody can help me in creating afl from my logic then whole forum can be benifited.

Here is the logic need to built in AFL
---------------
Chart display
Price
and
CCI indicator (if both are not possible then only CCI)
--------------
afl logic:

A = Last closed candles value of CCI indicator
B = 2nd last closed candles value of CCI indicator
C = 3rd last closed candles value of CCI indicator
D = 4th last closed candles value of CCI indicator
E = 5th last closed candles value of CCI indicator


AA = A/B
BB = B/C
CC = C/D
DD = D/E




Buy = {(AA > 0.50) and (AA< 0.80) } and
{(BB > 0.50) and (BB< 0.80) } and
{(CC > 0.50) and (CC< 0.80) } and
{(DD > 0.50) and (DD< 0.80) } AND
E < 0

Sell = {(AA > 0.50) and (AA< 0.80) } and
{(BB > 0.50) and (BB< 0.80) } and
{(CC > 0.50) and (CC< 0.80) } and
{(DD > 0.50) and (DD< 0.80) } AND
E > 0
 

rkkarnani

Well-Known Member
#3
I'm using CCI based trading which is showing me good result. I've tested it with manual in excel and it is showing me 73% accuracy with proper SL and Target.

If anybody can help me in creating afl from my logic then whole forum can be benifited.

Here is the logic need to built in AFL
---------------
Chart display
Price
and
CCI indicator (if both are not possible then only CCI)
--------------
afl logic:

A = Last closed candles value of CCI indicator
B = 2nd last closed candles value of CCI indicator
C = 3rd last closed candles value of CCI indicator
D = 4th last closed candles value of CCI indicator
E = 5th last closed candles value of CCI indicator


AA = A/B
BB = B/C
CC = C/D
DD = D/E




Buy = {(AA > 0.50) and (AA< 0.80) } and
{(BB > 0.50) and (BB< 0.80) } and
{(CC > 0.50) and (CC< 0.80) } and
{(DD > 0.50) and (DD< 0.80) } AND
E < 0

Sell = {(AA > 0.50) and (AA< 0.80) } and
{(BB > 0.50) and (BB< 0.80) } and
{(CC > 0.50) and (CC< 0.80) } and
{(DD > 0.50) and (DD< 0.80) } AND
E > 0
On what stock or index did you test the strategy in Excel sheet?
 

BNFTrader

Active Member
#4
Code:
_SECTION_BEGIN("CCI SYSTEM");
SetChartBkColor(colorBlack);
GraphXSpace=10;
Plot(C, "Close", colorDefault, styleCandle);  	
A = CCI(14); 
B = Ref(A,-1);//2nd last closed candles value of CCI indicator
C1 = Ref(A,-2);//3rd last closed candles value of CCI indicator
D = Ref(A,-3);//4th last closed candles value of CCI indicator
E = Ref(A,-4);//5th last closed candles value of CCI indicator
AA = A/B;		BB = B/C1;		CC = C1/D;		DD = D/E;
Buy  = ((AA > 0.50) AND (AA< 0.80) ) AND ((BB > 0.50) AND (BB< 0.80) ) AND ((CC > 0.50) AND (CC< 0.80) ) AND ((DD > 0.50) AND (DD< 0.80) ) AND E < 0;
Sell = ((AA > 0.50) AND (AA< 0.80) ) AND ((BB > 0.50) AND (BB< 0.80) ) AND ((CC > 0.50) AND (CC< 0.80) ) AND ((DD > 0.50) AND (DD< 0.80) ) AND E > 0;
SetPositionSize(1,4);
Buy  = ExRem(Buy,Sell);		Sell = ExRem(Sell,Buy);		
Short = Sell; 		Cover = Buy;

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30);
Plot(A,"CCI",colorYellow,styleThick|styleOwnScale,-300,300+2400);
Plot(-300,"",colorWhite,styleDashed|styleOwnScale,-300,300+2400,10);
Plot(300,"",colorWhite,styleDashed|styleOwnScale,-300,300+2400,10);
Plot(0,"",colorWhite,styleDashed|styleOwnScale,-300,300+2400,10);
_SECTION_END();

I'm using CCI based trading which is showing me good result. I've tested it with manual in excel and it is showing me 73% accuracy with proper SL and Target.

If anybody can help me in creating afl from my logic then whole forum can be benifited.

Here is the logic need to built in AFL
---------------
Chart display
Price
and
CCI indicator (if both are not possible then only CCI)
--------------
afl logic:

A = Last closed candles value of CCI indicator
B = 2nd last closed candles value of CCI indicator
C = 3rd last closed candles value of CCI indicator
D = 4th last closed candles value of CCI indicator
E = 5th last closed candles value of CCI indicator


AA = A/B
BB = B/C
CC = C/D
DD = D/E




Buy = {(AA > 0.50) and (AA< 0.80) } and
{(BB > 0.50) and (BB< 0.80) } and
{(CC > 0.50) and (CC< 0.80) } and
{(DD > 0.50) and (DD< 0.80) } AND
E < 0

Sell = {(AA > 0.50) and (AA< 0.80) } and
{(BB > 0.50) and (BB< 0.80) } and
{(CC > 0.50) and (CC< 0.80) } and
{(DD > 0.50) and (DD< 0.80) } AND
E > 0
 
Last edited:

BNFTrader

Active Member
#6
probably will never get an entry trigger with the above trading logic
Similar thoughts :)

But as a start the concept seems good

1. Looking for acceleration in indicator values over past 5 bars
2. Smoothness of this acceleration not too slow and not too fast . . .
3. specific location of initiating trade (abv/below zero line

Can tweak with combination of prev bars and values to refine your logic :thumb:

Thanks
 

Similar threads