Simple Coding Help - No Promise.

casoni

Well-Known Member
Hello everyone,

Back after a long time , :)

i am stuck in coding , Need to find HH followed by another HH [ no LH in between] and LL followed by another LL

kindly help me out
thank you


using Edward Pottash code for HH-LH-LL-HL


RequestTimedRefresh(0.1,True);
xx=BarIndex();x=xx;Lx=LastValue(x);
nbar=Param("N Pivot Bars",2,2,6,1);
tf=Param("Time Frame (min)",5,1,1440,1);tfrm=in1Minute*tf;
CleanPivots=ParamToggle("Use Clean Pivots","Off|On",1);
PivotSymmetry=ParamToggle("Use Symmetric Pivots","Off|On",1);


TimeFrameSet(tfrm);

if(PivotSymmetry)
{
fc=1;
pk=H>Ref(HHV(H,nbar*fc),-1) AND Ref(HHV(H,nbar),nbar)<=H;
tr=L<Ref(LLV(L,nbar*fc),-1) AND Ref(LLV(L,nbar),nbar)>=L;
}
else
{
fc=2;
pk=H>Ref(HHV(H,nbar*fc),-1) AND Ref(HHV(H,nbar),nbar)<=H;
tr=L<Ref(LLV(L,nbar*fc),-1) AND Ref(LLV(L,nbar),nbar)>=L;
}

px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
px3=ValueWhen(pk,x,3); tx3=ValueWhen(tr,x,3);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
ph3=ValueWhen(pk,H,3); tl3=ValueWhen(tr,L,3);

if(CleanPivots)
{
tr=IIf((tr==1 AND pk==1) AND px2<tx2,False,tr);
pk=IIf((tr==1 AND pk==1) AND px2>tx2,False,pk);

px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
px3=ValueWhen(pk,x,3); tx3=ValueWhen(tr,x,3);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
ph3=ValueWhen(pk,H,3); tl3=ValueWhen(tr,L,3);

tr=IIf(tr AND ((tx0<px0 AND tl1>tl0) OR (tx2>px1 AND tl1>=tl2) OR (px0==px1 AND tl1>tl0)),False,tr);
pk=IIf(pk AND ((px0<tx0 AND ph1<ph0) OR (px2>tx1 AND ph1<=ph2) OR (tx0==tx1 AND ph1<ph0)),False,pk);

px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
px3=ValueWhen(pk,x,3); tx3=ValueWhen(tr,x,3);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
ph3=ValueWhen(pk,H,3); tl3=ValueWhen(tr,L,3);

tr=IIf(tr AND ((tx0<px0 AND tl1>tl0) OR (tx2>px1 AND tl1>=tl2) OR (px0==px1 AND tl1>tl0)),False,tr);
pk=IIf(pk AND ((px0<tx0 AND ph1<ph0) OR (px2>tx1 AND ph1<=ph2) OR (tx0==tx1 AND ph1<ph0)),False,pk);

px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
px3=ValueWhen(pk,x,3); tx3=ValueWhen(tr,x,3);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
ph3=ValueWhen(pk,H,3); tl3=ValueWhen(tr,L,3);
}
pkh=IIf(pk,H,Null);
trl=IIf(tr,L,Null);
TimeFrameRestore();
fact=Nz(Max(tfrm/60,Interval()/60)/(Interval()/60));
if(fact==0)fact=1;
Lkbk=Nz(tfrm/Interval());
if(Lkbk>1)
{
pk=TimeFrameExpand(pk,tfrm,expandFirst);
pkh=TimeFrameExpand(pkh,tfrm,expandFirst);
pkhs=IIf(!IsEmpty(pkh),1,0);pkhs=pkhs-Ref(pkhs,-1);
pk=pk AND H==pkh;
cond1=Sum(pk,BarsSince(pkhs==1)+1)==1 AND pk;
pk=pk AND cond1;

tr=TimeFrameExpand(tr,tfrm,expandFirst);
trl=TimeFrameExpand(trl,tfrm,expandFirst);
trls=IIf(!IsEmpty(trl),1,0);trls=trls-Ref(trls,-1);
tr=tr AND L==trl;
cond1=Sum(tr,BarsSince(trls==1)+1)==1 AND tr;
tr=tr AND cond1;

px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
px3=ValueWhen(pk,x,3); tx3=ValueWhen(tr,x,3);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
ph3=ValueWhen(pk,H,3); tl3=ValueWhen(tr,L,3);


}
ll=tr AND tl1<tl2;
hl=tr AND tl1>tl2;
hh=pk AND ph1>ph2;
lh=pk AND ph1<ph2;
dt=pk AND ph1==ph2;
db=tr AND tl1==tl2;

ll_h=IIf(ll,1,0);
hl_h=IIf(hl,2,0);
hh_h=IIf(hh,3,0);
lh_h=IIf(lh,4,0);
dt_h=IIf(dt,5,0);
db_h=IIf(db,6,0);

combi=ll_h+hl_h+lh_h+hh_h+dt_h+db_h;

t0=ValueWhen(combi,combi,0);
t1=ValueWhen(combi,combi,1);
t2=ValueWhen(combi,combi,2);
t3=ValueWhen(combi,combi,3);
t4=ValueWhen(combi,combi,4);
t5=ValueWhen(combi,combi,5);

// bearisch pattern
beHH=pk AND t1==4 AND t2==2 AND (t3==3 OR t3==4) AND (t4==1 OR t4==2);
//PlotShapes(shapeHollowCircle*beHH,ColorRGB(255,193,193),0,H,10);

// bullish pattern
buHH=tr AND t1==2 AND t2==4 AND (t3==1 OR t3==2) AND (t4==3 OR t4==4);
//PlotShapes(shapeHollowCircle*buHH,ColorRGB(202,255,112),0,L,-10);

SetChartBkColor(ColorRGB(0,0,0));SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,colorGreen,IIf(C<=O,colorRed,colorLightGrey)));
Plot(C,"Price",IIf(C>O,colorDarkGreen,IIf(C<=O,colorDarkRed,colorLightGrey)),64,0,0,0,0);
Plot(pkh,"",colorRed,styleThick,0,0,0,-1);
Plot(trl,"",colorBrightGreen,styleThick,0,0,0,-1);
PlotShapes(shapeSmallCircle*tr,IIf(Lx-ValueWhen(tr,x)>nbar*fact,ColorRGB(0,100,0),colorWhite),0,L,-10);
PlotShapes(shapeSmallCircle*pk,IIf(Lx-ValueWhen(pk,x)>nbar*fact,ColorRGB(255,0,0),colorWhite),0,H,10);



Vd = ParamToggle("Plot VOL","No|Yes" ,1);
dispLabels = ParamToggle("Plot Pk-Tr","No|Yes" ,1);
vf=Prec(V/10000,2);
abcdy_up=32;
abcdy_dn=20;
function GetVisibleBarCount()
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
return Min(lvb-fvb,BarCount-fvb);
}
function GfxConvertPixelsToBarX(Pixels)
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
pxchartleft=Status("pxchartleft");
pxchartwidth=Status("pxchartwidth");
fac=pxchartwidth/Pixels;
bar=(lvb-fvb)/fac;
return Nz(bar);
}
function GfxConvertPixelToValueY(Pixels)
{
local Miny,Maxy,pxchartbottom,pxchartheight;
Miny=Status("axisminy");
Maxy=Status("axismaxy");
pxchartbottom=Status("pxchartbottom");
pxchartheight=Status("pxchartheight");
fac=pxchartheight/Pixels;
Value=(Maxy-Miny)/fac;
return Nz(Value);
}
function GfxConvertBarToPixelX(bar)
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
pxchartleft=Status("pxchartleft");
pxchartwidth=Status("pxchartwidth");
return Nz(pxchartleft+bar*pxchartwidth/(lvb-fvb+1));
}
function GfxConvertValueToPixelY(value)
{
local Miny,Maxy,pxchartbottom,pxchartheight;
Miny=Status("axisminy");
Maxy=Status("axismaxy");
pxchartbottom=Status("pxchartbottom");
pxchartheight=Status("pxchartheight");
return Nz(pxchartbottom-floor(0.5+(Value-Miny)*pxchartheight/(Maxy-Miny)));
}
AllVisibleBars=GetVisibleBarCount();
fvb=Status("firstvisiblebar");
abcdy_up=GfxConvertPixelToValueY(abcdy_up);
abcdy_dn=GfxConvertPixelToValueY(abcdy_dn);

for(i=0;i<AllVisibleBars;i++)
{ GfxSelectFont("Tahoma",8,500); GfxSetBkMode(1);
if(tr[i+fvb] AND Vd)
{
lvix=i+fvb;
GfxSetTextColor(5);GfxTextOut("V",GfxConvertBarToPixelX(i-1)-3,GfxConvertValueToPixelY(L[lvix]-abcdy_dn));
GfxSetTextColor(colorYellow);GfxTextOut(" "+Vf[lvix-1],GfxConvertBarToPixelX(i-1)-3,GfxConvertValueToPixelY(L[lvix]-abcdy_dn));
}

if(pk[i+fvb] AND Vd)
{
lvix=i+fvb;
GfxSetTextColor(4);GfxTextOut("V",GfxConvertBarToPixelX(i-1)-3,GfxConvertValueToPixelY(H[lvix]+abcdy_up));
GfxSetTextColor(colorYellow);GfxTextOut(" "+Vf[lvix-1],GfxConvertBarToPixelX(i-1)-3,GfxConvertValueToPixelY(H[lvix]+abcdy_up));

}

if(ll[i+fvb] AND dispLabels)
{
lvix=i+fvb;GfxSelectFont("Tahoma",8,500); GfxSetBkMode(1);
GfxSetTextColor(colordarkYellow);GfxTextOut("LL",
GfxConvertBarToPixelX(i)-3,GfxConvertValueToPixelY(L[lvix]-abcdy_dn-3));
}
if(hl[i+fvb] AND dispLabels)
{
lvix=i+fvb;GfxSelectFont("Tahoma",8,500); GfxSetBkMode(1);
GfxSetTextColor(colordarkYellow);GfxTextOut("HL",
GfxConvertBarToPixelX(i)-3,GfxConvertValueToPixelY(L[lvix]-abcdy_dn-3));
}

if(hh[i+fvb] AND dispLabels)
{
lvix=i+fvb;GfxSelectFont("Tahoma",8,500); GfxSetBkMode(1);
GfxSetTextColor(colordarkYellow);GfxTextOut("HH",
GfxConvertBarToPixelX(i)-5,GfxConvertValueToPixelY(H[lvix]+abcdy_up-3));
}
if(lh[i+fvb] AND dispLabels)
{
lvix=i+fvb;GfxSelectFont("Tahoma",8,500); GfxSetBkMode(1);
GfxSetTextColor(colordarkYellow);GfxTextOut("LH",
GfxConvertBarToPixelX(i)-5,GfxConvertValueToPixelY(H[lvix]+abcdy_up-3));
}


}

qq=Interval()/60;
if(qq < 60){tf=" min";tt=qq;}
else if(qq >= 60 AND qq < 1440){tf=" hrs";tt=qq/60;}
else if(qq >= 1440){tf=" days";tt=(qq/60)/24;}
qq=Max(tfrm/60,Interval()/60);
if(qq < 60){tfa=" min";tta=qq;}
else if(qq >= 60 AND qq < 1440){tfa=" hrs";tta=qq/60;}
else if(qq >= 1440){tfa=" days";tta=(qq/60)/24;}

Title = Name() + "[Pivots - E.P ]"+
"\nNbar: " + nbar +
"\nChart TF: " + tt + tf +
"\nTrend TF: " + tta + tfa;
 

amsin21

Well-Known Member
http://www.marketcalls.in/amibroker...campaign=Feed:+MarketCalls2009+(Market+Calls)



the above was posted in market calls .

i need some help for this i wanna get alerts when a particular price level is reached . i will daily enter the levels for diff stocks and do want to be get notified when those levels are reached . please look at the ways for this and suggest suitable ways to do that
Refer AlertIF function http://www.amibroker.com/guide/h_alerts.html, should cover your requirement
 

bunti_k23

Well-Known Member
bro's need some help here:)

these are the buy sell conditions iam using in the system



Buy = (C) > x1 AND PDI(20) > Ref(PDI(20),-1) AND MDI(20) < ADX(20) AND PDI(20) > ADX(20) AND issignal < 1;

Short = (C) < z1 AND MDI(20) > Ref(MDI(20),-1) AND PDI(20) < ADX(20) AND MDI(20) > ADX(20) AND issignal < 1;



the problem iam facing is the signals are not appearing on latest candle due to conditions met in historical values ,since we are using exrem function . in buy sell condition iam using 'c' and 'x1' or 'z1' but they are not specific i want to use 'x1' of latest candle ,so for 'z1' and 'c'.

in below charts i have explained the situation ,also is full code .




Code:
// COG: Center of Gravity indicator
// AFL code by E.M.Pottasch, 2011
// translated from: http://chartstudio.whselfinvest.com/files/CenterGravity_0.ctl
 
tf = Param( "TF", 1, 1, 375, 1 );

TimeFrameSet(in1Minute*tf );






sx=Null;b=Null;ai=Null;x=Null;
reg=x1=x2=x3=z1=z2=z3=Null;
rega=x1a=x2a=x3a=z1a=z2a=z3a=Null; 
     
bi=BarIndex(); 
eb=LastValue(bi);  
order=Param("n-th Order",1,1,50,1); 
bars=Param("Lookback Period",100,1,5000,1);
sv=ParamToggle("Use Selected Value","Off|On",1);
alt=ParamToggle("Error Levels","Fibonacci|Standard",0);
ecart=1.61803399;
   
if(sv)
{
    eb=SelectedValue(bi);
    bb=Max(0,eb-bars);
}
else
{
    bb=Max(0,eb-bars);
}
fin=eb;
nn=order+1;
sx[1]=bars+1;
 
if(fin>bars)
{
for(mi=1;mi<=2*nn-2;mi++)
{
    suml=0;
    for(n=0;n<=bars;n++)
    {
        suml=suml+n^mi;
    }
    sx[mi+1]=suml;
}
for(mi=1;mi<=nn;mi++)
{
    suml=0;
    for(n=0;n<=bars;n++)
    {
        if (mi==1)
            suml=suml+Close[fin-n];
        else
            suml=suml+Close[fin-n]*n^(mi-1);
            b[mi]=suml;
    }
}
for(jj=1;jj<=nn;jj++)
{
    for(ii=1;ii<=nn;ii++)
    {
        kk=ii+jj-1;
        ai[(ii-1)*nn+jj]=sx[kk];
    }
}
for(kk=1;kk<=nn-1;kk++)
{
    ll=0;
    mm=0;
    for(ii=kk;ii<=nn;ii++)
    {
        if(abs(ai[(ii-1)*nn+kk])>mm)
        {
            mm=abs(ai[(ii-1)*nn+kk]);
            ll=ii;
        }
    }
    if(ll==0) break;
    if(ll!=kk)
    {
        for(jj=1;jj<=nn;jj++)
        {
            tt=ai[(kk-1)*nn+jj];
            ai[(kk-1)*nn+jj]=ai[(ll-1)*nn+jj];
            ai[(ll-1)*nn+jj]=tt;
        }
        tt=b[kk];
        b[kk]=b[ll];
        b[ll]=tt;
    }
    for(ii=kk+1;ii<=nn;ii++)
    {
        qq=ai[(ii-1)*nn+kk]/ai[(kk-1)*nn+kk];
        for(jj=1;jj<=nn;jj++)
        {
            if(jj==kk)
                ai[(ii-1)*nn+jj]=0;
            else
                ai[(ii-1)*nn+jj]=ai[(ii-1)*nn+jj]-qq*ai[(kk-1)*nn+jj];
        }
        b[ii]=b[ii]-qq*b[kk];
    }
}
x[nn]=b[nn]/ai[nn*nn];
for(kk=1;kk<=nn-1;kk++)
{
    tt=0;
    ii=nn-kk;
    for(jj=1;jj<=nn-ii;jj++)
    {
        tt=tt+ai[(ii-1)*nn+ii+jj]*x[ii+jj];
        if(ai[(ii-1)*nn+ii]!=0)
            x[ii]=(b[ii]-tt)/ai[(ii-1)*nn+ii];
    }
}
for(n=0;n<=bars;n++)
{
    suml=0;
    for(kk=1;kk<=order;kk++)
    {
        suml=suml+x[kk+1]*n^kk;
    }
    reg[fin-n]=x[1]+suml;
}
}
SetChartOptions(0, chartShowDates);
Title = "Symbol: "+ Name()+ "\n>>>AMIT TRADING SYSTEM<<<\nmade by BUNTI_K23 ";
if(alt)
{
dev=StDev(Close-reg,bars);
sd=dev[fin];
x1a=reg+sd*1;//68%
x2a=reg+sd*2;//95%
x3a=reg+sd*3;//99.83%
z1a=reg-sd*1;
z2a=reg-sd*2;
z3a=reg-sd*3;
Plot(C, "Close",colorLightGrey,styleCandle);
Plot(reg,"reg",colorBlue,1);
Plot(x3a,"x3a",ColorRGB(255,0,0),styleThick);
Plot(x2a,"x2a",ColorRGB(255,100,100),styleDashed);
Plot(x1a,"x1a",ColorRGB(255,200,200),styleDashed);
Plot(z3a,"z3a",ColorRGB(0,255,0),styleThick);
Plot(z2a,"z2a",ColorRGB(100,255,100),styleDashed);
Plot(z1a,"z1a",ColorRGB(200,255,200),styleDashed);
PlotOHLC(x3a,x3a,x1a,x1a,"",ColorRGB(30,0,0),styleCloud|styleNoLabel,0,0,0,-1);
PlotOHLC(z1a,z1a,z3a,z3a,"",ColorRGB(0,30,0),styleCloud|styleNoLabel,0,0,0,-1);
}
else
{
dev=StDev(Close,bars);
sd=ecart*dev[fin];
x1=reg+sd/(1.382*1.618);
x2=reg+sd/1.382;
x3=reg+sd;
z1=reg-sd/(1.382*1.618);
z2=reg-sd/1.382;
z3=reg-sd;
Plot(C, "Close",colorLightGrey,styleCandle);
//Plot(reg,"reg",colorBlue,1);
//Plot(x3,"x3",ColorRGB(255,0,0),styleThick);
//Plot(x2,"x2",ColorRGB(255,100,100),styleDashed);
Plot(x1,"x1",ColorRGB(255,200,200),styleDashed);
//Plot(z3,"z3",ColorRGB(0,255,0),styleThick);
//Plot(z2,"z2",ColorRGB(100,255,100),styleDashed);
Plot(z1,"z1",ColorRGB(200,255,200),styleDashed);
PlotOHLC(x3,x3,x2,x2,"",ColorRGB(30,0,0),styleCloud|styleNoLabel,0,0,0,-1);
PlotOHLC(z2,z2,z3,z3,"",ColorRGB(0,30,0),styleCloud|styleNoLabel,0,0,0,-1);
}





TimeFrameRestore();




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

////////////////////////
Length = 8;
Price = EMA(Close, Length);
 
// Keltner
kLength = Length;
kN = 1.5;
kATR = ATR(kLength);
kUpper = Price + kN * kATR;
kLower = Price - kN * kATR;
 
// Bollinger
bbLength = Length;
bbN = 2;
bbStDevValues = StDev(Close, bbLength);
bbUpper = Price + bbN * bbStDevValues;
bbLower = Price - bbN * bbStDevValues;
 
IsSignal =
    bbUpper <= kUpper AND
    bbLower >= kLower;
 ///////////////////////////////////

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



Buy =  (C) > x1 AND PDI(20) > Ref(PDI(20),-1) AND MDI(20) < ADX(20) AND PDI(20) > ADX(20) AND issignal < 1;

Short =   (C) < z1 AND MDI(20) > Ref(MDI(20),-1) AND PDI(20) < ADX(20) AND MDI(20) > ADX(20) AND issignal < 1;



Buy = ExRem( Buy, Short );
Short = ExRem( Short, Buy );


PlotShapes( Buy*shapeUpArrow, colorWhite, 0, Low );
PlotShapes( Short*shapeDownArrow, colorWhite, 0, High );

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



DayH = TimeFrameGetPrice("H", in1Minute, 0);
DayL = TimeFrameGetPrice("L", in1Minute, 0);
DayC = TimeFrameGetPrice("C", in1Minute, 0);
DayO = TimeFrameGetPrice("O", in1Minute, 0);
pDayC = TimeFrameGetPrice("C", in1Minute, -1);

FS=Param("Font Size",15,11,100,1);
GfxSelectFont("Comic Sans M", FS , 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( colorBlack );
Hor=Param("Horizontal Position",820,1,1200,1);
Ver=Param("Vertical Position",1,1,830,1);
GfxTextOut(""+C, Hor, Ver);
GfxSetTextColor( colorGrey50 );
GfxTextOut("PC:"+pDayC,700, Ver);
GfxSetTextColor( colorBlue );
GfxTextOut("C:"+DayC, 600, Ver);
GfxSetTextColor(colorRed );
GfxTextOut("L:"+DayL,500, Ver);
GfxSetTextColor(colorBrightGreen );
GfxTextOut("H:"+DayH,400, Ver);
GfxSetTextColor( colorLightBlue );
GfxTextOut("O:"+DayO,300, Ver);

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

_SECTION_BEGIN("Background");
    SetChartOptions(0,chartShowArrows|chartShowDates);
    SetChartBkColor(ParamColor("Outer panel",colorGrey40)); // color of outer border
    SetChartBkGradientFill( ParamColor("Inner panel upper",colorGrey40),ParamColor("Inner panel lower",colorBlack));
    tchoice=Param("Title Selection ",2,1,2,1);
 
Plot(C, "", IIf(O>=C, colorOrange, colorGreen), ParamStyle("Price Style",styleCandle, maskPrice));
 
//////////////////////////////////////////////////////////////////
 
Last edited:

amitrandive

Well-Known Member
Sir,
When I add Buy and Sell Signals as advised, the following error comes. Please help to rectify the error
1 .Buy = C < ( BBandBot( P, Periods, Width );-----

Error 32. Syntax error, unexpected ‘;’. Is there semicolon missing at the end of the previous line?

2 . Sell = C > ( BBandBot( P, Periods, Width );-----
Error 32. Syntax error, unexpected ‘;’. Is there semicolon missing at the end of the previous line?

3 .Buy = ExRem( Buy, Sell );

Error 29. Variable ‘ buy ‘ used without having been initialized.

4 .Buy = ExRem( Buy, Sell );

Error 29. Variable ‘ sell ‘ used without having been initialized.


With Thanks
RaniHosur
Try this

Code:
_SECTION_BEGIN("Price1");
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", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style ); 
_SECTION_END();

Price = ParamField("Price", 4);
//Periods = Param("Periods", 15, 2, 100, 1 );
//Width = Param("Width", 2, 0, 10, 0.05 );
//Color = ParamColor("Color", colorRed );
 
bbt = BBandTop( Price , Periods, Width );
bbb = BBandBot( Price , Periods, Width );
Buy = C < bbb;
Sell = C > bbt;

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, L, H ), -25 );
 
Hi ,

I am new to trading after reading a lot on afl I have decided to buy amibroker software

Two question

1. Shall I buy amibroker pro or standard, is there limitation in standard ?
2. Do I need to buy directly through amibroker site or are there frenchise available

Thanks in advance

Mukesh
 

Similar threads