CCi Afl

foloz

New Member
#1
What should be the formula to print the price when CCI crosses 0. I don't want it on closing basis but want the exact price when it crossed the zero line. Can someone help ?

Regards
 

sr114

Well-Known Member
#2
here is the code

HTML:
_SECTION_BEGIN("Background_Setting");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),
ParamColor("BgBottom", colorDarkGrey),ParamColor("TitleBack",colorGrey40)); 
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
SetChartOptions(0,chartShowArrows|chartShowDates);
_SECTION_END();

_SECTION_BEGIN("CCI cross zero");
pds = Param( "Periods", 14, 1, 200, 1 );
cc=CCI(pds);

a=Cross(cc,0);
b=Cross(0,cc);

col=IIf(a,colorBrightGreen,colorRed);

Plot( CC, "", col, styleLine,styleThick );
Plot(0,"",colorWhite,styleLine,styleThick);
Title = 
EncodeColor(colorWhite)+ "CCI and Close price " + "\n " + Name() + " | " + EncodeColor(colorBrightGreen)
+ EncodeColor(colorBrightGreen) + "\n " + Date() 
+"\n"+EncodeColor(colorWhite) +" Zero crossed CCI Cls Price ="+ IIf(a,C,IIf(b,C,Null)) ;
_SECTION_END();
rgds
subroto
 

sr114

Well-Known Member
#4
Hi its on closing. I wanted the actual price when CCI crossed zero line.

Regards
Actual Price - can u elaborate a bit more? whether will it be LTP (last trade price) or CMP (cash market price) or a variant of OHLC or any customized price array?

rgds
subroto
 

johnnypareek

Well-Known Member
#5
Actual Price - can u elaborate a bit more? whether will it be LTP (last trade price) or CMP (cash market price) or a variant of OHLC or any customized price array?

rgds
subroto
Bhai,

I guess his mean to say is like at what price shud be next bar that its cross 0.

Actually he need to know in advance that what price which trades will make that go above 0
 

foloz

New Member
#6
Hi, I want the price when the CCI crosses zero line at that point of time. Not the LTP or price on closing basis or other parameters. When CCi crosses zero line, at that point of time the price of stock should get printed & not vary.

Regards,
 

sr114

Well-Known Member
#7
Bhai,

I guess his mean to say is like at what price shud be next bar that its cross 0.

Actually he need to know in advance that what price which trades will make that go above 0
so kinda reverse engineering the CCI to get the actual price but on what price - O,H,L,C or any customised prices or price of any other scrip?

if u r not being able to explain what u want then how 1 cud give the explanation?

what i posted is the easiest way to get the price at the crossover.
now if u want to show ur nose differently in a difficult way then u can apply a loop or u can plainly apply valuewhen function

HTML:
_SECTION_BEGIN("Background_Setting");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),
ParamColor("BgBottom", colorDarkGrey),ParamColor("TitleBack",colorGrey40)); 
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
SetChartOptions(0,chartShowArrows|chartShowDates);
_SECTION_END();

_SECTION_BEGIN("CCI confirmation");
pds = Param( "Periods", 14, 1, 200, 1 );
cc=CCI(pds);

a=Cross(cc,0);
b=Cross(0,cc);

//Vala = ValueWhen(a,C,1);
//Valb = ValueWhen(b,C,1);

prca=prcb=Vala=Valb=0;

for( i = 0; i < BarCount; i++ )
 {
      if( Prca == 0 AND a[ i ] )
      {
        Prca = C[ i ];
        Vala = ValueWhen(prca[i],C,1);
      }

      if( Prcb == 0 AND b[ i ] )
      {
      Prcb = C[ i ];
      Valb = ValueWhen(prcb[i],C,1);
      }
 } //*/

col=IIf(a,colorBrightGreen,colorRed);

Plot( CC, "CCi", col, styleLine,styleThick );
Plot(0,"",colorWhite,styleLine,styleThick);

Title = EncodeColor(colorWhite)+ "CCI and Price " + "\n " + Name() + " | "
+ EncodeColor(colorBrightGreen) + "\n " + Date() +"  | "" + interval(2)
+"\n"+EncodeColor(colorWhite) +" CCI ="+ cc
+"\n"+EncodeColor(colorWhite) +" Zero crossed CCI  Price ="+ IIf(a,vala,IIf(b,valb,Null)) ;
_SECTION_END();
upper pane - afl posted earlier
lower pane - revised in this post with either value when or loop


now tell me where i made the mistake? or it needs more coding

rgds
subroto
 

sr114

Well-Known Member
#8
Hi, I want the price when the CCI crosses zero line at that point of time. Not the LTP or price on closing basis or other parameters. When CCi crosses zero line, at that point of time the price of stock should get printed & not vary.

Regards,
so what u want - time of crossover or the price?

cud u elaborate with an image

rgds
subroto
 

foloz

New Member
#9
so what u want - time of crossover or the price?

cud u elaborate with an image

rgds
subroto
Example : In 5 min Cci crossed the zero line at 1075 price and closed at 1080. I want 1075 to be printed. The high was 1085, low - 1070 & open 1070.

Regards,
 

sr114

Well-Known Member
#10
Example : In 5 min Cci crossed the zero line at 1075 price and closed at 1080. I want 1075 to be printed. The high was 1085, low - 1070 & open 1070.

Regards,
Do u have any realtime quote povider? or do u get quotes in ur time and sales window?

if yes then the real price at which crossover occurred is possible otherwise its not possible
 

Similar threads