Karthik's Intraday Trading using EMA & CCI

pakatil

Well-Known Member
#44
smarttrade,

My data seems so diff from yours. Hence unable to mark your trades on my chart. BTW I get data from IBC.

Feeling good that you are able to trade successfully. Congrats. :clapping:
 

lvgandhi

Well-Known Member
#49
I have made the afl.
I have made modifications for filter a constant value of 5 and added brokerage points and profit loss value of 50 instead of 10 as I was testing for BNF.

But it has some error, which I could not solve so far. I am giving afl below. If some one can rectify it, I will be thankful.

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", IIf(C>O,colorGreen,colorRed), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Periods = Param("Periods", 110, 2, 300, 1, 10 );
Plot( EMA( C, Periods ),"EMA"+Periods, ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("Trade");
brokeragePoints=5;
tradeFilter=5;
stopSize=50;
profitSize=stopSize+brokeragePoints;
Cc=CCI(14);
em=EMA(C,110);
t=TimeNum();
Buy=0;
Sell=0;
Short=0;
Cover=0;
BP=0;
SP=0;
lng=0;
shrt=0;
for( i = 1; i < BarCount; i++ )
{

if( lng ==0 AND CC[i-1] > 100 AND C[i-1] > em[i-1] AND H >= (H[i-1]+tradeFilter) AND t > 091500 AND t < 151500 )
{
Buy=1;
lng=1;
BP= H[i-1]+tradeFilter;
}
else
{
Buy[ i ] = 0; // remove excess buy signals
lng = 0;
}

if( lng == 1 AND Low[ i ] <= BP- stopSize)
{
Sell[ i ] = 1;
SellPrice[ i ] = BP- stopSize;
lng = 0;
Bp=0;
}

if( lng == 1 AND High[ i ] >= BP+stopSize+ brokeragePoints )
{
Sell[ i ] = 1;
SellPrice[ i ] = BP+ stopSize+ brokeragePoints ;
lng = 0;
Bp=0;
}

if(lng ==1 AND t > 152500)
{
Sell[ i ] = 1;
SellPrice[ i ] = C;
lng = 0;
BP=0;
}

if( shrt ==0 AND Cc[i-1] < -100 AND C[i-1] < em[i-1] AND L <= (L[i-1]-tradeFilter) AND t > 091500 AND t < 151500 )
{
Short=1;
shrt=1;
SP= L[i-1]-tradeFilter;
}
else
{
Short[ i ] = 0; // remove excess buy signals
shrt = 0;
}

if( shrt == 1 AND High[ i ] >= SP+ stopSize)
{
Cover[ i ] = 1;
CoverPrice[ i ] = SP+stopSize;
shrt = 0;
SP=0;
}

if( shrt == 1 AND Low[ i ] <= SP-stopSize- brokeragePoints )
{
Cover[ i ] = 1;
CoverPrice[ i ] = SP-stopSize-brokeragePoints ;
shrt = 0;
SP=0;

}

if(shrt ==1 AND t > 152500)
{
Cover[ i ] = 1;
CoverPrice[ i ] = C;
shrt = 0;
SP=0;

}

}

PlotShapes(Buy*shapeUpArrow,colorGreen,0,Low);
PlotShapes(Sell*shapeHollowDownArrow,colorRed,0,High);
PlotShapes(Short*shapeDownArrow,colorRed,0,High);
PlotShapes(Cover*shapeHollowUpArrow,colorGreen,0,Low);

_SECTION_END();
 
Last edited:
#50
Dear Karthick,
I have some doubts. Can you clarify this?

Today Maruti Futures opened Above EMA110 and CCI 100 . Here should we check filter for each and every candle or take First Candle high ?
9.15 Candle :
High : 1462.25
Low : 1448.45
Filter : 1.46
Buy > 1463.75

9.20 Candle :
High : 1458
Low : 1450.75
Filter : 1.45
Buy > 1459.45

9.25 Candle :
High : 1459.80
Low : 1456
Filter : 1.45
Buy > 1461.25

9.30 Candle :
High : 1468.85
Low : 1456.60
Filter : 1.45
Buy > 1470.30

As per 9.15 Candle data Buy > 1463.75 . It Crossed @ 9.30 Candle or if we should check each and every candle high then buy level crossed @ 9.25 candle (as per 9.20 Candle high) . which is Correct?
 

Similar threads