Simple Coding Help - No Promise.

Seniors,
I need the AFL for Stochastic Oscillator as per Smart Trade’s Thread “How to trade with an Oscillator”
So please post the AFL for Stochastic Oscillator as discussed in the above thread
PriyaRamesh
 

jallanankit

Well-Known Member
Hello guys!!

Looking for some help!!

I want to capture the HIGH/LOW made after BUY/SHORT entry has come..
We can do it in the EXPLORATION function in amibroker..

The idea is to capture what is the maximum potential of every trade..

I have been able to capture the entry price and the exit price..

Dont really understand what i m missing in my code to capture the highs and lows..

pls help
 

josh1

Well-Known Member
Hi Guys,
Need some help from you.
I want to identify inside close candles.
Conditions are like this---
1. When Ref(C, -1) > Ref(L,-2) and Ref(C, -1) < Ref(H, -2), Previous candle is inside candle. In simple english, If close of a candle is between High and Low of candle previous to it, it is inside candle,.

2. High and Low of the earlier candle become basis. So Ref(L, -2) and Ref(H, -2) remain base values, say BaseHi and BaseLo. All subsequent candles whose close is between these two base values to be treated as inside candles. ( I guess, we have to use static variables ). I would like to have different colour for these inside candles.

Edit- We do not change BaseHi and BaseLo until there is a breakout close outside these points. That is even if there is another candle whose close is between H and L of earlier candle, we ignore it until there is a breakout of first such base.

3. When a candle closes outside of these values, that is above BaseHi or below BaseLo is breakout candle. It can be coloured seperately. (I prefer to find this candle for Ref(C, -1) since in intraday, price can go above or below these values and in last few seconds, it goes inside so that close is inside)

4. Once a break out happens, all candles are normal until there is a close inside earlier H L.

 
Last edited:
Hi Josh

See if this is what you want.

Code:
_SECTION_BEGIN("Price");
SetChartBkColor(colorBlack);
GraphXSpace=5;
_N(Title = StrFormat("{{NAME}} {{DATE}} {{INTERVAL}}: O=%1.2f, H=%1.2f, L=%1.2f, C=%1.2f, V=%1.0f\n{{VALUES}}", O, H, L, C, V));

BaseHi[1]    = H[0];		
BaseLo[1]    = L[0];
IamInside[1] = C[1] < BaseHi[1] AND C[1] > BaseLo[1];

for (i = 2; i < BarCount; i++) 
{
	if (IamInside[i-1]) 
	{
		IamInside[i] = C[i] < BaseHi[i-1] AND C[i] > BaseLo[i-1];
		if (IamInside[i])
	 	{
			BaseHi[i] = BaseHi[i-1];
			BaseLo[i] = BaseLo[i-1];	
		}
		else
		{
			BaseHi[i] = H[i-1];
			BaseLo[i] = L[i-1];		
		}		
	}
	else
	{
		IamInside[i] = C[i] > L[i-1] AND C[i] < H[i-1];
		BaseHi[i] = H[i-1];
		BaseLo[i] = L[i-1];		
	}
}

SetBarFillColor(IIf(C > O, colorBlack, colorRed)); 
BarColor = IIf(NOT IamInside,colorYellow,IIf(C < O, colorRed, colorBlueGrey));
Plot(C, "Close", Barcolor, styleCandle | styleNoTitle);  	

// Can comment out or delete the following 
PlotShapes(IamInside*21,colorWhite,0,L,-10);
Plot(BaseHi, "BH",colorBlueGrey, styleDashed|styleStaircase);  	
Plot(BaseLo, "BL",colorLime, styleDashed|styleStaircase);  	
_SECTION_END();

Happy :)
 

amitrandive

Well-Known Member
Hi Josh

See if this is what you want.

Code:
_SECTION_BEGIN("Price");
SetChartBkColor(colorBlack);
GraphXSpace=5;
_N(Title = StrFormat("{{NAME}} {{DATE}} {{INTERVAL}}: O=%1.2f, H=%1.2f, L=%1.2f, C=%1.2f, V=%1.0f\n{{VALUES}}", O, H, L, C, V));

BaseHi[1]    = H[0];		
BaseLo[1]    = L[0];
IamInside[1] = C[1] < BaseHi[1] AND C[1] > BaseLo[1];

for (i = 2; i < BarCount; i++) 
{
	if (IamInside[i-1]) 
	{
		IamInside[i] = C[i] < BaseHi[i-1] AND C[i] > BaseLo[i-1];
		if (IamInside[i])
	 	{
			BaseHi[i] = BaseHi[i-1];
			BaseLo[i] = BaseLo[i-1];	
		}
		else
		{
			BaseHi[i] = H[i-1];
			BaseLo[i] = L[i-1];		
		}		
	}
	else
	{
		IamInside[i] = C[i] > L[i-1] AND C[i] < H[i-1];
		BaseHi[i] = H[i-1];
		BaseLo[i] = L[i-1];		
	}
}

SetBarFillColor(IIf(C > O, colorBlack, colorRed)); 
BarColor = IIf(NOT IamInside,colorYellow,IIf(C < O, colorRed, colorBlueGrey));
Plot(C, "Close", Barcolor, styleCandle | styleNoTitle);  	

// Can comment out or delete the following 
PlotShapes(IamInside*21,colorWhite,0,L,-10);
Plot(BaseHi, "BH",colorBlueGrey, styleDashed|styleStaircase);  	
Plot(BaseLo, "BL",colorLime, styleDashed|styleStaircase);  	
_SECTION_END();

Happy :)
Sirji

Good to have you back !!!
:clapping::clapping::clapping:
 
Hi ,

Help me to fix this code. created by Vijayansceb sir. I tried reaching him but no response till yet.

///////////////////////////////////////////////////////////////////////////////////////////
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, Close:%g ,{{VALUES}}",O,C ));

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

_SECTION_BEGIN("Volume");

cx = Param("cxposn",476,0,1200,1);
cy = Param("cyposn", 500,0,1000,10 );

GfxSelectFont( " Arial ", 14, 98, False );
GfxSetTextColor(ColorRGB(10,250,250));

GfxTextOut("Volume : " +Volume+ "", cx +20,cy +50);



_SECTION_END( );


_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;

x=Param("xposn",918,0,1000,1);
y=Param("yposn",586,0,1000,1);

GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );
if ( NewPeriod )
{
GfxSelectSolidBrush( colorYellow );
GfxSelectPen( colorYellow, 2 );
Say( "New period" );
}
GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 9, 700, False );
GfxSetTextColor( colorBlack );
GfxTextOut( ""+SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
_SECTION_END();

_SECTION_BEGIN("Title");

DDayO = TimeFrameGetPrice("O", inDaily);
DHiDay = TimeFrameGetPrice("H", inDaily);
DLoDay = TimeFrameGetPrice("L", inDaily);
gfr = TimeFrameGetPrice("C", inDaily, -1);//close


Title = EncodeColor(colorWhite)+ EncodeColor(ColorRGB(220,10,150)) +" "+ Interval(2) + " " + Date() +
EncodeColor(ColorRGB(200,150,120)) + " \n Open " + O +", High : " + H +", Low : " + L+ EncodeColor(colorGreen) +
" * Prevvious Day Close : " + EncodeColor(colorGreen) + gfr +EncodeColor(colorYellow)+
"\n ToDay Open : " +DDayO + " High : " +DHiDay + " Low : "+ DLoDay;
_SECTION_END();

_SECTION_BEGIN("ema");
Lk = EMA(Close,22);
Plot (lk," ",colorBrightGreen,styleDots);


GfxSelectFont("tohomabold", Status("pxheight")/16);
GfxSetTextAlign( 6 );
GfxSetTextColor(ColorRGB(10,250,250));
GfxSetBkMode(0);
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/10 );

cx=Param("cxposn",1085,0,1200,1);
cy=Param("cyposn",16,0,1000,1);
GfxSetBkColor(ColorRGB(200,50,100));
GfxSelectFont( "tohomabold",20,98, False);
GfxSetTextColor( colorYellow);
GfxSetTextColor( ColorHSB( 100, 10, 400) );
GfxTextOut("LTP. "+C+" ", cx, cy );

_SECTION_END();

Plot(EMA(C,13),"",colorYellow);
/////////////////////////////////////////////////////////////

per1=Param ("per1", 0.325,0.1,50,0.10);

per=per1;
x = Cum(1);
s1=L;
s11=H;
pS = TroughBars( s1, per, 1 ) == 0;
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, 1 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleDashed);

pR = PeakBars( s11, per, 1 ) == 0;
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, 1 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleDashed);
//////////////////////////////////////////////////////////////////////////////////////////////////
perc=per1;
x=BarIndex();xx=SelectedValue(x);
t1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,x)) ;
H1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,C)) ;
t11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, x));
H11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, C));
g=t1>t11;
shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x ==t11));
Color=IIf(g,colorRed,colorGreen);
PlotShapes(shape,color);
/////////////////////////////////////////////////////////////////////////////////////////////////

per=per1;

x = Cum(1);
s1=C;
s11=C;
pS = TroughBars( s1, per, 1 ) == 0;
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 = PeakBars( s11, per, 1 ) == 0;
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);
Plot(g4,"",colorGreen,styleThick);
//////////////////////////////////////////////////////////////////////////////


The problem which I am facing in this

1. The signal comes when further two three candles crosses and then previous candle signal generates. I want that Signal gets generated spontenously so that trade can be made at alerted price.

2. After generation of signal, the arrow vanishes. At least Rate stamp should remain like "Buy @ XXX".

Let me know if any other clarification requires.

I belong from Commerce background have NIL knowledge of coding language. Please help.
 

vijkris

Learner and Follower
Hi ,

Help me to fix this code. created by Vijayansceb sir. I tried reaching him but no response till yet.

Code:
///////////////////////////////////////////////////////////////////////////////////////////
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, Close:%g ,{{VALUES}}",O,C ));

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

_SECTION_BEGIN("Volume");

cx = Param("cxposn",476,0,1200,1);
cy = Param("cyposn", 500,0,1000,10 );

GfxSelectFont( " Arial ", 14, 98, False );
GfxSetTextColor(ColorRGB(10,250,250));

GfxTextOut("Volume : " +Volume+ "", cx +20,cy +50);



_SECTION_END( );


_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;

x=Param("xposn",918,0,1000,1);
y=Param("yposn",586,0,1000,1);

GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 ); 
if ( NewPeriod )
{
GfxSelectSolidBrush( colorYellow );
GfxSelectPen( colorYellow, 2 ); 
Say( "New period" ); 
}
GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
GfxSetBkMode(1); 
GfxSelectFont( "Arial", 9, 700, False );
GfxSetTextColor( colorBlack );
GfxTextOut( ""+SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
_SECTION_END();

_SECTION_BEGIN("Title");

DDayO = TimeFrameGetPrice("O", inDaily);
DHiDay = TimeFrameGetPrice("H", inDaily);
DLoDay = TimeFrameGetPrice("L", inDaily);
gfr = TimeFrameGetPrice("C", inDaily, -1);//close


Title = EncodeColor(colorWhite)+ EncodeColor(ColorRGB(220,10,150)) +" "+ Interval(2) + " " + Date() +
EncodeColor(ColorRGB(200,150,120)) + " \n Open " + O +", High : " + H +", Low : " + L+ EncodeColor(colorGreen) +
" * Prevvious Day Close : " + EncodeColor(colorGreen) + gfr +EncodeColor(colorYellow)+
"\n ToDay Open : " +DDayO + " High : " +DHiDay + " Low : "+ DLoDay;
_SECTION_END();

_SECTION_BEGIN("ema");
Lk = EMA(Close,22);
Plot (lk," ",colorBrightGreen,styleDots);


GfxSelectFont("tohomabold", Status("pxheight")/16);
GfxSetTextAlign( 6 );
GfxSetTextColor(ColorRGB(10,250,250));
GfxSetBkMode(0);
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/10 );

cx=Param("cxposn",1085,0,1200,1);
cy=Param("cyposn",16,0,1000,1);
GfxSetBkColor(ColorRGB(200,50,100));
GfxSelectFont( "tohomabold",20,98, False);
GfxSetTextColor( colorYellow);
GfxSetTextColor( ColorHSB( 100, 10, 400) );
GfxTextOut("LTP. "+C+" ", cx, cy );

_SECTION_END();

Plot(EMA(C,13),"",colorYellow);
/////////////////////////////////////////////////////////////

per1=Param ("per1", 0.325,0.1,50,0.10);

per=per1;
x = Cum(1);
s1=L;
s11=H;
pS = TroughBars( s1, per, 1 ) == 0;
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, 1 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleDashed);

pR = PeakBars( s11, per, 1 ) == 0;
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, 1 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleDashed);
//////////////////////////////////////////////////////////////////////////////////////////////////
perc=per1;
x=BarIndex();xx=SelectedValue(x);
t1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,x)) ;
H1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,C)) ;
t11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, x));
H11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, C));
g=t1>t11;
shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x ==t11));
Color=IIf(g,colorRed,colorGreen);
PlotShapes(shape,color);
/////////////////////////////////////////////////////////////////////////////////////////////////

per=per1;

x = Cum(1);
s1=C;
s11=C;
pS = TroughBars( s1, per, 1 ) == 0;
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 = PeakBars( s11, per, 1 ) == 0;
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);
Plot(g4,"",colorGreen,styleThick);
//////////////////////////////////////////////////////////////////////////////
The problem which I am facing in this

1. The signal comes when further two three candles crosses and then previous candle signal generates. I want that Signal gets generated spontenously so that trade can be made at alerted price.

2. After generation of signal, the arrow vanishes. At least Rate stamp should remain like "Buy @ XXX".

Let me know if any other clarification requires.

I belong from Commerce background have NIL knowledge of coding language. Please help.
hi, I have limited knowledge of afl. the commands used in this afl looks into future. so u will see signals after 2,3 bars.
thanks
 
Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, High %g, Low %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Signal Panel");
no=10;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
s5d=IIf(avn==1,sup,res);

showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
if (showsl == 1)
{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}

exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);

Buy = exitshort;
Sell = exitlong;
//Short = Sell;
//Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "Buy @ " + C, 1 );
AlertIf( Sell, "", "Sell @ " + C, 2 );

for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "Buy";
sl = s5d[i];
//tar1 = entry + (entry * .0050);
//tar2 = entry + (entry * .0092);
//tar3 = entry + (entry * .0179);



//to make changes below targets
tar1 = entry + 2*ATR(20);
tar2 = entry + 4*ATR(20);
tar3 = entry + 6*ATR(20);





bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "Sell";
entry = C[i];
sl = s5d[i];
//tar1 = entry - (entry * .0050);
//tar2 = entry - (entry * .0112);
//tar3 = entry - (entry * .0212);

//tar1 = entry - (entry * 0.050);
//tar2 = entry - (entry * 0.112);
//tar3 = entry - (entry * 0.212);




tar1 = entry -2*ATR(20);
tar2 = entry -4*ATR(20);
tar3 = entry - 6*ATR(20);


bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "Buy", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1));
sl = ssl[BarCount-1];
//Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+entry, BarCount-3,entry,Null,colorBlue);
PlotText("TGT-1@"+tar1,BarCount-4,tar1,Null,Clr);
PlotText("TGT-2@"+tar2,BarCount-4,tar2,Null,Clr/);
PlotText ("TGT-3@"+tar3,BarCount-4,tar3,Null,Clr);

}

messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( sig =="Buy")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 310;

y = pxHeight;

GfxSelectPen( colorGreen, 5); // broader color
GfxRoundRect( x, y - 142, x2, y , 7, 7 ) ;
GfxTextOut( Name(),12,y-140);
GfxTextOut( " Last Traded Price = "+ C , 08,y- 120 );
GfxTextOut( ( "Signal Panel"),160,y-140);
GfxTextOut( (" "),27,y-160);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-100) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="Buy",sig + " @ ",sig + " @") + " : " + entry), 13, y-80);
GfxTextOut( ("Trailing Stop Loss : " + sl + " (P/L:" + WriteVal(IIf(sig == "Sell",entry-sl,sl-entry), 2.2) + ")"), 13, y-60);
GfxTextOut( ("TGT:1 : " + tar1), 13, y -40);
GfxTextOut( ("Current Profit/Loss : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 40, y-22);;

}
_SECTION_END();



_SECTION_BEGIN("Sound Alert");
AlertIf( Buy, "SOUND C:\\Windows\\Media\\Chord.wav", "Sell " + C,2,1+2,1);
AlertIf( Sell, "SOUND C:\\Windows\\Media\\tada.wav","Buy " + C,1,1+2,1);
_SECTION_END();



_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",15,30,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorBlue) );
Hor=Param("Horizontal Position",750,800,800,800);
Ver=Param("Vertical Position",27,27,27,27);
GfxTextOut("L.T.P="+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5.45, Ver+45 );
_SECTION_END();


_SECTION_BEGIN("");
GfxSetOverlayMode(0);
GfxSelectPen( colorRed, 3 );
GfxSelectSolidBrush( colorLightYellow );
GfxRoundRect( 350, 38,665, 70, 15, 15 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 17.5, 700, False );
GfxSetTextColor( colorBrown );
GfxSetTextAlign(0);
GfxSetTextColor( colorBlack );
GfxTextOut( " Last Traded Price = "+ BuyPrice , 350, 40);
_SECTION_END();


_SECTION_BEGIN("Isfandi Technical Viewer");
//Plot(C,"",ParamColor( "Color", colorBlue ),ParamStyle("Style") );
//---- pivot points
GfxSetBkColor(colorBlue);
GfxSetTextColor( colorLime );
GfxSelectFont("Times New Roman", 20, 1,500, True );
GfxTextOut(" Intraday Trading System ", 20 , 40 );
_SECTION_END();


_SECTION_BEGIN(" Buy Sell Signal Confirm ");
BarColors =
IIf(BarsSince(Buy) < BarsSince(Sell)
AND BarsSince(Buy)!=0, colorGreen,
IIf(BarsSince(Sell) < BarsSince(Buy)
AND BarsSince(Sell)!=0, colorRed, colorBlue));
//Plot the Candlestick charts
Plot(C, "Close", BarColors, styleNoTitle | ParamStyle("Style") | GetPriceStyle() ) ;
_SECTION_END();

_SECTION_BEGIN("Show Up Down Arrow & Price ");
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
AlertIf( Buy, "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );

dist = 1.8*ATR(15);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy@" + L[ i ], i, L[ i ]-dist[i], colorWhite, colorGreen );
if( Sell[i] ) PlotText( "Sell@" + H[ i ], i, H[ i ]+dist[i], colorWhite, colorRed );
}


PlotShapes( shape, IIf( Buy, colorBlue, colorRed ), 0, IIf( Buy, Low, High )
);

_SECTION_END();
 
Last edited:

Similar threads