AmiBroker formula Language

Hi friends

Please some afl writers help me for the following:-

1) Fixed horizontal display for intraday trading from 0900 to 1530hrs.
2) pivot points from previous day candle.
3) any other indicator to overlay
4) running intraday's max and min price lines.

on another pane I want OBV(C) which I found the IndiaBulls software (image and the OBV(c) data extracted from that chart.

From my Point of view this OBV(c) is the resultant volume seen at that time and price, either resultant Buy Delivery Volume or Sold Delivery Volume.

I think this indicator may enhance profitability when used with other AFLs.

Please Help me.

Thanking You all.
 
_SECTION_BEGIN("Chart Settings");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer Panel",1));
SetChartBkGradientFill(ParamColor("Upper Chart",1),ParamColor("Lower Chart",23));
GraphXSpace=Param("GraphXSpace",10,0,100,1);
dec = (Param("Decimals",2,0,7,1)/10)+1;
bi = BarIndex();
Lbi = LastValue(BarIndex());
sbi = SelectedValue(bi);
x1= BarCount-1;
SetBarFillColor (IIf(C>O,19,IIf(C<O,24,42)));
Plot(C,"",IIf(C>O,51,IIf(C<O,33,55)),64);

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN("SV X Pivots");
pct = Param( "Pivot %",0.18,0.10,60,0.01);
plt = ParamToggle("Plot Zig ","Off|On",0);
ppa = ParamToggle("Plot Pattern Lines","Off|On",1);
plx = ParamToggle("Plot Time Lines","Off|On",1);
Vsh= Param("Time Line V Shift",0.25,0,10,0.01);
ptx = ParamToggle("Plot Text","Off|On",1);
HiLb= Param("Hi Lookback",1,1,x1,1);
LoLb= Param("Lo Lookback",1,0,x1,1);
//==============================
pk=PeakBars(H,pct)==0; tr=TroughBars(L,pct)==0;
zHi=Zig(H,pct); zLo=Zig(L,pct); HLAvg=(zHi+zLo)/2;
zp=IIf(pk,zHi,IIf(tr,zLo,IIf(HLAvg>Ref(HLAvg,-1),H,L)));
za=Zig(zp,pct);
pR=Ref(za,-1)<za AND za>Ref(za,1);//pk
pS=Ref(za,-1)>za AND za<Ref(za,1);//tr
//==============================
if(plt==1)Plot(za,"ZIG",42,32|4096);
//==============================
//Support
xs0 = SelectedValue(ValueWhen(PS,bi,LoLb));
xs1 = SelectedValue(ValueWhen(pS,bi,LoLb+1));
xs2 = SelectedValue(ValueWhen(pS,bi,LoLb+2));
xs3 = SelectedValue(ValueWhen(pS,bi,LoLb+3));
xs4 = SelectedValue(ValueWhen(pS,bi,LoLb+4));
ys0 = SelectedValue(ValueWhen(pS,L,LoLb));
ys1 = SelectedValue(ValueWhen(pS,L,LoLb+1));
ys2 = SelectedValue(ValueWhen(pS,L,LoLb+2));
ys3 = SelectedValue(ValueWhen(pS,L,LoLb+3));
ys4 = SelectedValue(ValueWhen(pS,L,LoLb+4));
//Resistance
xr0 = SelectedValue(ValueWhen(pR,bi,HiLb));
xr1 = SelectedValue(ValueWhen(pR,bi,HiLb+1));
xr2 = SelectedValue(ValueWhen(pR,bi,HiLb+2));
xr3 = SelectedValue(ValueWhen(pR,bi,HiLb+3));
xr4 = SelectedValue(ValueWhen(pR,bi,HiLb+4));
yr0 = SelectedValue(ValueWhen(pR,H,HiLb));
yr1 = SelectedValue(ValueWhen(pR,H,HiLb+1));
yr2 = SelectedValue(ValueWhen(pR,H,HiLb+2));
yr3 = SelectedValue(ValueWhen(pR,H,HiLb+3));
yr4 = SelectedValue(ValueWhen(pR,H,HiLb+4));
Sup = xs0>xr0;
Res = xr0>xs0;
xsh = 50;
xsbi = IIf(Res, xr0-xsh, xs0-xsh);//xstart

za=Zig(zp,0.01);
pR=Ref(za,-1)<za AND za>Ref(za,1);//pk
pS=Ref(za,-1)>za AND za<Ref(za,1);//tr
eLy = SelectedValue(ValueWhen(pS,L,0));
eHy = SelectedValue(ValueWhen(pR,H,0));
d1 = IIf(sup,ely,ehy);
c1 = IIf(sup,ehy,ely);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN("Patterns");
//Assign Letter to Pivots
if(Res==1) {
col= 40; colp= 32; va1= 0.30; va2= -0.30;
Sx = xs4; Sy = ys4; Tx = xr4; Ty = yr4;
Ux = xs3; Uy = ys3; Vx = xr3; Vy = yr3;
Wx = xs2; Wy = ys2; Xx = xr2; Xy = yr2;
Ax = xs1; Ay = ys1; Bx = xr1; By = yr1;
Cx = xs0; Cy = ys0; Dx = xr0; Dy = yr0;
}
if(Sup==1) {
col= 51; colp= 43; va1= -0.30; va2= 0.30;
Sx = xr4; Sy = yr4; Tx = xs4; Ty = ys4;
Ux = xr3; Uy = yr3; Vx = xs3; Vy = ys3;
Wx = xr2; Wy = yr2; Xx = xs2; Xy = ys2;
Ax = xr1; Ay = yr1; Bx = xs1; By = ys1;
Cx = xr0; Cy = yr0; Dx = xs0; Dy = ys0;
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//Calculate Hi Lo Retracements
WX=(abs(xy-wy)/abs(wy-vy))*100;
XA=abs(Xy-Ay)/abs(Xy-Wy)*100;
AB=abs(By-Ay)/abs(Xy-Ay)*100;
BC=abs(By-Cy)/abs(By-Ay)*100;
CD=abs(Dy-Cy)/abs(By-Cy)*100;
CE=(abs(Cy-c1)/abs(Cy-By))*100;
DE=(abs(Dy-d1)/abs(Cy-Dy))*100;

//Calculate Hi-Hi Lo-Lo Retracements
XBi= abs(Xy-By)/(abs(Xy-Ay))*100;
XBe= abs(By-Ay)/(abs(Xy-Ay))*100;
XB = IIf(By>=Ay,XBe,XBi);
XD=abs(Dy-Ay)/abs(Xy-Ay)*100;
ACi=abs(Cy-Ay)/abs(By-Ay)*100;
ACe=abs(By-Cy)/abs(By-Ay)*100;
AC = IIf(Cy>=Ay,ACi,ACe);
BDi=abs(Dy-By)/abs(By-Cy)*100;
BDe=abs(Dy-Cy)/abs(By-Cy)*100;
BD = IIf(Dy>=By,BDe,BDi);
//Plot Labels and Retracements
if(ptx==1) {
PlotText(" S ",sx,sy + va2, col,1); PlotText(" T ",tx,ty + va1, col,1);
PlotText(" U ",ux,uy + va2, col,1); PlotText(" V ",vx,vy + va1, col,1);
PlotText(" W ",IIf(sup,xr2,xs2),wy + va2, col,1);
PlotText(" X = "+NumToStr(WX,1.1)+" % ",xx,xy + va1, col,1);
PlotText(" A = "+NumToStr(XA,1.1)+" % ",ax,ay + va2, col,1);
PlotText(" B = "+NumToStr(AB,1.1)+" % ",bx,by + va1, col,1);
PlotText(" C = "+NumToStr(BC,1.1)+" % ",cx,cy + va2, col,1);
PlotText(" D = "+NumToStr(CD,1.1)+" % ",dx,dy + va1, colp,1);
PlotText(" "+NumToStr(de,1.1)+"%",(dx+x1)/2,(dy+d1)/2,42,1);
PlotText(" "+NumToStr(ce,1.1)+"%",(cx+x1)/2,(cy+c1)/2,42,1);
PlotText(" "+NumToStr(XB,1.1)+" %",((xx+bx)/2)-2,(xy+by)/2, 40,1);
PlotText(" "+NumToStr(XD,1.1)+" %",(xx+dx)/2,(xy+dy)/2, 34,1);
PlotText(" "+NumToStr(AC,1.1)+" %",(ax+cx)/2-2,(ay+cy)/2, 10,1);
PlotText(" "+NumToStr(BD,1.1)+" %",((bx+dx)/2)-2,(by+dy)/2, 10,1);
}
//Plot Hi-Hi Lo-Lo Lines
if(ppa==1) {
Plot(LineArray(dx,dy,x1,d1,0),"",42,32|4096);
Plot(LineArray(cx,cy,x1,c1,0),"",42,32|4096);
Plot(LineArray(sx,sy,ax,ay,1),"",35,41|4096|2048);
Plot(LineArray(ux,uy,ax,ay,1),"",25,41|4096|2048);
Plot(LineArray(bx,by,dx,dy,0),"",34,32|4096);
Plot(LineArray(ax,ay,cx,cy,0),"",34,32|4096);
Plot(LineArray(xx,xy,dx,dy,0),"",32,32|4096);
Plot(LineArray(xx,xy,bx,by,0),"",32,32|4096);
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//Count Bars Between Pivots
xXA=xsbi+abs(ax-xx);
xXB=xsbi+abs(bx-xx);
xXC=xsbi+abs(cx-xx);
xXD=xsbi+abs(dx-xx);
xAB=xsbi+abs(bx-ax);
xAC=xsbi+abs(cx-ax);
xAD=xsbi+abs(dx-ax);
xBC=xsbi+abs(cx-bx);
xBD=xsbi+abs(dx-bx);
xCD=xsbi+abs(dx-cx);
//==============================
if(plx==1) {
bc=IIf(sup,sbi-xs0,sbi-xr0);
tp=IIf(sup,ys0-Vsh,yr0+Vsh);
if(Res==1) {
col=42;
Plot(bi==xCD, "", colorYellow, styleHistogram|styleOwnScale,0,1,xsh);//sample code if lines are preferred
PlotText("XA\n | "+NumToStr(abs(xx-ax)-bc,1),xxa+xsh,tp,col,1);
PlotText("XB\n | "+NumToStr(abs(bx-xx)-bc,1),xxb+xsh,tp,col,1);
PlotText("XC\n | "+NumToStr(abs(cx-xx)-bc,1),xxc+xsh,tp,col,1);
PlotText("XD\n | "+NumToStr(abs(xx-dx)-bc,1),xxd+xsh,tp,col,1);
PlotText("AB\n | "+NumToStr(abs(bx-ax)-bc,1),xab+xsh,tp,col,1);
PlotText("AC\n | "+NumToStr(abs(cx-ax)-bc,1),xac+xsh,tp,col,1);
PlotText("AD\n | "+NumToStr(abs(dx-ax)-bc,1),xad+xsh,tp,col,1);
PlotText("BC\n | "+NumToStr(abs(cx-bx)-bc,1),xbc+xsh,tp,col,1);
PlotText("BD\n | "+NumToStr(abs(dx-bx)-bc,1),xbd+xsh,tp,col,1);
PlotText("CD\n | "+NumToStr(abs(dx-cx)-bc,1),xcd+xsh,tp,col,1);
}
if(Sup==1) {
col=34;
Plot(bi==xCD, "", colorYellow, styleHistogram|styleOwnScale,0,1,xsh);//sample code if lines are preferred
PlotText("| "+NumToStr(abs(xx-ax)-bc,1)+"\nXA",xxa+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(bx-xx)-bc,1)+"\nXB",xxb+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(cx-xx)-bc,1)+"\nXC",xxc+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(xx-dx)-bc,1)+"\nXD",xxd+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(bx-ax)-bc,1)+"\nAB",xab+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(cx-ax)-bc,1)+"\nAC",xac+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(dx-ax)-bc,1)+"\nAD",xad+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(cx-bx)-bc,1)+"\nBC",xbc+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(dx-bx)-bc,1)+"\nBD",xbd+xsh,tp,col,1);
PlotText("| "+NumToStr(abs(dx-cx)-bc,1)+"\nCD",xcd+xsh,tp,col,1);
}
}
//example of plotting line with start at a future point
f50= ys0+(abs(yr0-ys0)*0.50);
Plot(LineArray(xxb,f50,xxd,f50,0),"",29,32,0,0,xsh );
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Title = EncodeColor(55)+ Title = Name() + " " + EncodeColor(32) + Date() + " " + EncodeColor(5) + "{{INTERVAL}} " +
EncodeColor(55)+ " Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
EncodeColor(55)+ " High = "+ EncodeColor(5) + WriteVal(H,dec) +
EncodeColor(55)+ " Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
EncodeColor(55)+ " Close = "+ EncodeColor(52)+ WriteVal(C,dec)+
EncodeColor(55)+ " Volume = "+ EncodeColor(52)+ WriteVal(V,1);
Reply With Quote
 
Help Required Please !
[Posting it again...Sorry]

Have a condition to be coded in Afl.. Seniors please help.
I want to Buy when this bar crosses the high of signal bar.
[Have coded a condition for signal bar ]

On any given timeframe.. say at this moment or this candle is a signal bar, I want to BUY when the next candle crosses the high of the signal bar.

Seniors please help !
 
Hi.
It is very simple, but I found it difficult to integrate.:confused:
EMA 1 is colored EMA(50) and EMA2(200) is modified to have line with dots.
I want colored EMA instead of line, but with coloredline+ coloreddots.
I know it to be simple, but could not accomplish it by myself.
If you can help please post the AFL,Else please do not wate your time and resources.
thanks in adevance
SRJC


_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 200, 2, 200, 1, 10 );
Plot(EMA( P, Periods ), _DEFAULT_NAME(),
IIf(EMA( P, Periods ) > Ref(EMA( P, Periods ),-1),ParamColor("Rising EMA", colorBlue),ParamColor("Falling EMA", colorRed)));
_SECTION_END();

_SECTION_BEGIN("EMA2");
P = ParamField("Price field",-1);
Periods = Param("Periods", 50, 2, 300, 1, 10 );
Plot( EMA(P, Periods), _DEFAULT_NAME(),( colorBlack), styleLine+styleDots,styleThick,styleDots );
 
i want amibroker to draw horizontal line at the crossover of two exp. moving averages (c(7,13) how to do afl for that?

any senior help me?

thanks sir in advance
 

msa5678

Well-Known Member
Hi All,

I don't remember where I got this AFL
from, But , it is a good one, It is giving
fairly productive alerts on hourly time
frame.

The Problem is I want to do Automatic
Analysis on this AFL. I am getting error
msgs, when I do Automatic Analysis.

Can Seniors pls help....



///////// advance trenlines with candle pivots ///////////////////
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} ,{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C, "", IIf(O>=C, colorOrange, colorGreen),styleCandle);

SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
_N(Title = EncodeColor(colorWhite)+StrFormat(" {{NAME}} - {{INTERVAL}} {{DATE}} Open:%g,high:%g,low:%g, Close:%g ,{{VALUES}}",O,H,L,C ));

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


farback=Param("How Far back to go",100,50,5000,10);
nBars = Param("Number of bars", 12, 5, 40);
aHPivs = H - H;aLPivs = L - L;
aHPivHighs = H - H;aLPivLows = L - L;aHPivIdxs = H - H;aLPivIdxs = L - L;
nHPivs = 0;nLPivs = 0;lastHPIdx = 0;lastLPIdx = 0;lastHPH = 0;lastLPL = 0;
curPivBarIdx = 0;
aHHVBars = HHVBars(H, nBars);aLLVBars = LLVBars(L, nBars);
aHHV = HHV(H, nBars);aLLV = LLV(L, nBars);
aVisBars = Status("barvisible");nLastVisBar = LastValue(Highest(IIf(aVisBars, BarIndex(), 0)));
_TRACE("Last visible bar: " + nLastVisBar);
curBar = (BarCount-1);curTrend = "";if (aLLVBars[curBar] < aHHVBars[curBar]) {
curTrend = "D";}else {curTrend = "U";}
for (i=0; i<farback; i++) {curBar = (BarCount - 1) - i;
if (aLLVBars[curBar] < aHHVBars[curBar]) {
if (curTrend == "U") {curTrend = "D";
curPivBarIdx = curBar - aLLVBars[curBar];aLPivs[curPivBarIdx] = 1;aLPivLows[nLPivs] = L[curPivBarIdx];
aLPivIdxs[nLPivs] = curPivBarIdx;nLPivs++;}
} else {if (curTrend == "D") {curTrend = "U";curPivBarIdx = curBar - aHHVBars[curBar];
aHPivs[curPivBarIdx] = 1;aHPivHighs[nHPivs] = H[curPivBarIdx];
aHPivIdxs[nHPivs] = curPivBarIdx;nHPivs++;}} }
curBar = (BarCount-1);candIdx = 0;candPrc = 0;lastLPIdx = aLPivIdxs[0];lastLPL = aLPivLows[0];
lastHPIdx = aHPivIdxs[0];lastHPH = aHPivHighs[0];if (lastLPIdx > lastHPIdx) {
candIdx = curBar - aHHVBars[curBar];candPrc = aHHV[curBar];
if (lastHPH < candPrc AND candIdx > lastLPIdx AND candIdx < curBar) {
aHPivs[candIdx] = 1;
for (j=0; j<nHPivs; j++) {aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-(j+1)];
aHPivIdxs[nHPivs-j] = aHPivIdxs[nHPivs-(j+1)];}aHPivHighs[0] = candPrc ;
aHPivIdxs[0] = candIdx;nHPivs++;}} else {
candIdx = curBar - aLLVBars[curBar];candPrc = aLLV[curBar];if (lastLPL > candPrc AND
candIdx > lastHPIdx AND candIdx < curBar) {
aLPivs[candIdx] = 1;
for (j=0; j<nLPivs; j++) {aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)];
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];}aLPivLows[0] = candPrc;
aLPivIdxs[0] = candIdx;nLPivs++;}}
for (k=0; k<nHPivs; k++) {_TRACE("High pivot no. " + k
+ " at barindex: " + aHPivIdxs[k] + ", "
+ WriteVal(ValueWhen(BarIndex()==aHPivIdxs[k],
DateTime(), 1), formatDateTime)+ ", " + aHPivHighs[k]);}
a1=ahpivs==1;a2=alpivs==1;
PlotShapes(a1* shapeSmallCircle, colorRed, 0,H, Offset=0);
PlotShapes(a2*shapeSmallCircle , colorGreen, 0,L, Offset=0);
//////////////////////////////////////////////////////
x = Cum(1);s1=L;s11=H;pS = a2 == 1;
endt= SelectedValue(ValueWhen( pS, x, 1 ));
startt=SelectedValue(ValueWhen( pS, x, 2 ));dtS =endt-startt;
endS = SelectedValue(ValueWhen( pS, s1, 1 ) );
startS = SelectedValue( ValueWhen( pS, s1, 2 ));aS = (endS-startS)/dtS;
bS = endS;trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleThick);
pR = a1== 1;endt1= SelectedValue(ValueWhen( pR, x, 1 ));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
startR = SelectedValue( ValueWhen( pR, s11, 2 ));
aR = (endR-startR)/dtR;bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);


Regards,
 
I got this afl called "NMA Swing System" since i could not decode the formula please any one give me same in excel or give link where i can get the same result in excel worksheet

thanks in advance

_SECTION_BEGIN("NICK MA Swing");
SetBarsRequired(200,0);

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",4,3,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorBlack, styleCandle | styleNoLabel );
j=Haclose;

//=======================================================================================================================
//=========================Indicator==============================================================================================
f=ATR(14);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;
NW[0] = 0;


for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(j < NW[i-1])
{
Trend = -1;
NW = j + Revers;
}
else
{
Trend = 1;
if((j - Revers) > NW[i-1])
{
NW = j - Revers;
}
else
{
NW = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j > NW[i-1])
{
Trend = 1;
NW = j - Revers;
}
else
{
Trend = -1;
if((j + Revers) < NW[i-1])
{
NW = j + Revers;
}
else
{
NW = NW[i-1];
}
}
}
}

//===============system================

Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "NICK MA Swing System" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();
 

Similar threads