New bhs systems buy sell nifty

#11
hi i have this buysell system installed on my amibroker. dont know how to get the afl. if some one reach me at nsoundar-at-gmail-dot-com, i can get it out to you all. regarding the usuage, i have v mixed feedback. the support/resistance lines that appear after 9:30 am is good. i m doing reverse trading using that. sell at resistance and buy at support. its giving decent results. still i m searching for a good system that delivers atleast 30 points in nifty ...thanks
soundaran
 

kaly422000

Well-Known Member
#12
Vishal;

I know about you are running one tips company tuljaconsultancy no.1 cheat, i made loss becos of you,all failure calls ,useless service you run prtfolio , i dont know how many people loose money becouse of you, correct yourself before you talk about others, people like you i imagine like street dogs in road side hotel looking for people will throw dish opening your mouth.
dont talk
this forum has some rules. dont use such words.
 
#14
I want combine two afl.

One afl is candalstick chart with Buy Sell Signal.

Afl is belowe.

_SECTION_BEGIN("Ensign Volatility Stop");

// Ensign Volatility Stop
// get the multiple of 9 period EMA of ATR_Ensign

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
k=Param("multiplication factor", 1,0.5,5,0.1);

period=k*5;
VS_raw = 2.2 * EMA(ATR(1), period);

// for longs, VS line is below price
loline = VS_below_price = HHV(Close, period) - VS_raw;

// for shorts, VS line is above price
hiline = VS_above_price = LLV(Close, period) + VS_raw;
between = IIf (C < hiline AND C > loline, 1, 0);
up = IIf(C > hiline OR (H > Ref(H, -1) AND H > hiline), 1, 0);
dn = IIf(C < loline OR (L < Ref(L, -1) AND L < loline), 1, 0);
upcond = IIf(between AND BarsSince(up) < BarsSince(dn) , 1, 0);
dncond = IIf(between AND BarsSince(dn) < BarsSince(up) , 1, 0);
upline = IIf(up OR upcond, loline, Null);
dnline = IIf(dn OR dncond, hiline, Null);

Buy=upline;
Sell=dnline;

Col = IIf(Buy,colorGreen,IIf(Sell,colorRed,colorBlack));

Plot(C, "", col, styleBar | styleThick );

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorBrightGreen, colorRed ),0, IIf( Buy, Low, High ) );


Second afl is SUPPORT AND RESISTANCE These afl is show All support and Resistance.

The afl is below

//|-----------------------------------------------------------------------------------------
//|PatternExplorer.com - Support & Resistance
//|Copyright 2007, PatternExplorer.com
//|http://www.PatternExplorer.com
//|e-mail: [email protected]
//|-----------------------------------------------------------------------------------------
FormulaName = "PE - S & R";

SetChartOptions( 0, chartShowDates | chartLogarithmic | chartWrapTitle );
#pragma nocache
#include_once <\PEInc\PatternExplorer_f0.afl>
#include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Defaults.afl"
#include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Mods.afl"
/************************************************** *****************************************/
AddCustomCodeBeforePE();
/************************************************** *****************************************/

_SECTION_BEGIN( "Main Parameters" );
AddparamUsefromChart( def_UseFromChart );
Sensitivity = Param( "Sensitivity", 10, 0, 100, 1 );

if ( InChart )
StaticVarSet( "FYIOKU", Sensitivity );

if ( inAA AND Usefromchart )
Sensitivity = StaticVarGet( "FYIOKU" );

DisRange = Param( "Plot 'far away' Lines Trigger", 3, 0, 10, 0.5 );

Color_SL = ParamColor( "Support", def_Color1 );

Color_RL = ParamColor( "Resistance", colorRed );

_SECTION_END();

/************************************************** *****************************************/
#include_once <\PEInc\PatternExplorer_1.afl>
#include_once <\PEInc\Lib\PatternExplorer_f15.afl>
/************************************************** *****************************************/
BS = break_G1_val == 1 OR break_G2_val == 1;

SS = break_G1_val == -1 OR break_G2_val == -1;

Buy = def_Buy AND BS;

Sell = SS;

/************************************************** *****************************************/
Filter = def_Filter AND BarIndex() == LastValue( BarIndex() ) AND NOT GroupID() == 253;

Filter = Filter AND ( Buy OR Sell );

/************************************************** *****************************************/
Addefaultcolumns();

Adddefaultcolumns( 2, 1 );

AddTextColumn(
WriteIf( break_G1_val == -1, "Break",
WriteIf( break_G1_val == 1, "Break", "" ) ), "Minor Levels", 1.2,
IIf( break_G1_val == 1, colorGreen, IIf( break_G1_val == -1, colorRed, colorBlue ) ) );

AddTextColumn(
WriteIf( break_G2_val == -1, "Break",
WriteIf( break_G2_val == 1, "Break", "" ) ), "Major Levels", 1.2,
IIf( break_G2_val == 1, colorGreen, IIf( break_G2_val == -1, colorRed, colorBlue ) ) );

AddTextColumn( FullName(), "Full name" );

/************************************************** *****************************************/
Plot( IIf( x >= XT1 & RT1 &NOT T1 == 0, T1, -1e10 ), "T1", IIf( LastValue( C ) < T1, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XT2 & RT2 &NOT T2 == 0, T2, -1e10 ), "T2", IIf( LastValue( C ) < T2, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XT3 & RT3 &NOT T3 == 0, T3, -1e10 ), "T3", IIf( LastValue( C ) < T3, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XT4 & RT4 &NOT T4 == 0, T4, -1e10 ), "T4", IIf( LastValue( C ) < T4, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XT5 & RT5 &NOT T5 == 0, T5, -1e10 ), "T5", IIf( LastValue( C ) < T5, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XP1 & RP1 &NOT P1 == 0, P1, -1e10 ), "P1", IIf( LastValue( C ) < P1, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XP2 & RP2 &NOT P2 == 0, P2, -1e10 ), "P2", IIf( LastValue( C ) < P2, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XP3 & RP3 &NOT P3 == 0, P3, -1e10 ), "P3", IIf( LastValue( C ) < P3, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XP4 & RP4 &NOT P4 == 0, P4, -1e10 ), "P4", IIf( LastValue( C ) < P4, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XP5 & RP5 &NOT P5 == 0, P5, -1e10 ), "P5", IIf( LastValue( C ) < P5, Color_RL, Color_SL ), 1 + 2048 + styleNoTitle );

Plot( IIf( x >= XT6 & RT6 &NOT T6 == 0, T6, -1e10 ), "T6", IIf( LastValue( C ) < T6, Color_RL, Color_SL ), 8 + 2048 + styleNoTitle );

Plot( IIf( x >= XT7 & RT7 &NOT T7 == 0, T7, -1e10 ), "T7", IIf( LastValue( C ) < T7, Color_RL, Color_SL ), 8 + 2048 + styleNoTitle );

Plot( IIf( x >= XP6 & RP6 &NOT P6 == 0, P6, -1e10 ), "P6", IIf( LastValue( C ) < P6, Color_RL, Color_SL ), 8 + 2048 + styleNoTitle );

Plot( IIf( x >= XP7 & RP7 &NOT P7 == 0, P7, -1e10 ), "P7", IIf( LastValue( C ) < P7, Color_RL, Color_SL ), 8 + 2048 + styleNoTitle );

/************************************************** *****************************************/
ToolTip = def_ToolTip;

/************************************************** *****************************************/
AddCustomCodeAfterPE();

/************************************************** *****************************************/
Title = "PatternExplorer.com - Support & Resistance" + default_priceTitle + EncodeColor( IIf( NOT AnZ, def_Text2, colorRed ) ) + ",Sensitivity = " + WriteVal( Sensitivity, 1 ) + " " + EncodeColor( colorRed ) + WriteIf( NOT AnZ, "", " NO POINTS AVAILABLE -> REDUCE SENSITIVITY " );


Any one can combine these two afl.
If price is 5200 on bar chart.
Support is 5100 and resitance is 5400.
i want support resistance price on bar chart.
Support means stop loss and resitance means target.
Means current nifty trade 5200 stop loss is 5100 and target is 5400.
these information is show on bar chart without support and resitance chart.

If any one can do these pls try.

Thanks
 
#15
Here is the new bhs afl which i found on the net.
_SECTION_BEGIN("BuySell-nodll-ewef");
//-------------------------------------------------------------------------
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat(" Open %g, Hi %g, Lo %g, Close %g (%.1f%%)", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));


T=26;
BHSda=((C-MA(C,T))/MA(C,T))*100; // func fixed
Graph0=BHSda;
Graph0Style=2+4;
Graph0BarColor=IIf(BHSda>0,5,4);
GraphXSpace=5;

SetChartOptions(0,chartShowArrows|chartShowDates);
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleCandle );
Plot( O, "Open", ParamColor("Color", colorBlack ), styleNoDraw);
Plot( H, "High", ParamColor("Color", colorBlack ), styleNoDraw);
Plot( L, "Low", ParamColor("Color", colorBlack ),styleNoDraw);


//------------------------------------------------------------------------------
Value1 = 60;//Param("BearRes", 60, 1, 100, 0.1 );
Value2 = 40;//Param("BullSup", 40, 1, 100, 0.1 );
BHSMPPer= 13;//Param("Time periods", 13, 1, 100 );
BHEXPerc = 2 * BHSMPPer- 1;

BSAU = EMA(Max( C - Ref (C, -1 ),0) , BHEXPerc );
BSAC = EMA(Max( Ref( C, -1 ) - C,0), BHEXPerc );
x1=(BHSMPPer-1)* ((BSAC * Value1 )/(100-Value1) - BSAU);
BSR1 = IIf( x1 >= 0, C + x1, C + x1 * (100-Value1)/Value1 );
x2=(BHSMPPer-1)* ((BSAC * Value1 )/(100-Value2) - BSAU);
BSR2 = IIf( x2 >= 0, C + x2, C + x2 * (100-Value2)/Value2 );

Plot( BSR1, "", colorOrange,styleDashed);
Plot( BSR2, "", colorPaleBlue,styleDashed );

//------------------------------------------------------------------------------


r1 = 12;//Param( "Fast avg", 12, 2, 200, 1 );
r2 = 26;//Param( "Slow avg", 26, 2, 200, 1 );
r3 = 9;//Param( "Signal avg", 9, 2, 200, 1 );
Z = 1;//Param("zig",1,0,10,0.1);


Cond1 = Cross(MACD(r1,r2),Signal(r1,r2,r3));
Cond3 = Zig(C,z)>Ref(Zig(C,z),-4);
Buy = Cond1 AND Cond3;

Cond4 = Cross(Signal(r1,r2,r3),MACD(r1,r2));
Cond6 = Zig(C,z)<Ref(Zig(C,z),-4);
Sell = Cond4 AND Cond6;

Trigger = WriteIf(Buy, "Buy", "") + WriteIf(Sell, "Sell", "");
BSG = IIf(Buy, colorPaleGreen, IIf(Sell, colorRose, colorDefault));
BSFG = IIf(Buy, colorDarkGreen, IIf(Sell, colorDarkRed, colorDefault));


//------------------------------------------------------------------------------------------------

if((Status("action") == actionExplore) OR (Status("action") == actionScan))
Filter = Buy OR Sell;
SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "Symbol", 77, BSFG, BSG, 120);
AddColumn(DateTime(), "Date", formatDateTime, BSFG, BSG, 100);
AddColumn(TimeNum() ,"Time",1,BSFG, BSG, 100);
AddColumn( Buy, "Buy", 1,BSFG, BSG, 50);
AddColumn( Sell, "Sell", 1,BSFG, BSG, 50 );
AddColumn( O, "Open", 1.2,BSFG, BSG, 100 );
AddColumn( H, "High", 1.2,BSFG, BSG, 100 );
AddColumn( L, "Low", 1.2,BSFG, BSG, 100 );
AddColumn( C, "Close", 1.2,BSFG, BSG, 100 );
AddColumn(Ref(V,-1),"P-Vol",1,BSFG, BSG, 100);
AddColumn(V/(Ref(V,-1)*100),"Increase in Vol",1,BSFG, BSG, 100);

shape= (Buy * shapeHollowUpTriangle )+(Sell *shapeHollowDownTriangle);
PlotShapes( shape, IIf( Buy, colorBlue, colorBlue ), 0, IIf( Buy, Low, High ) );
GraphXSpace = 7;

//---------------------------------------------------------------------------------------------------------
C13=20;//Param("fonts",20,10,30,1 );
C14=2.1;//Param("left-right",2.1,1.0,5.0,0.1 );
C15=12;//Param("up-down",12,1,20,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode(transparent=1);
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorRGB (217,217,213));
GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.4 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.45 );
GfxSetTextColor( colorWhite);
GfxSelectFont("MS Sans Serif", 10, 500, False, False, 0);
//------------------------------------------------------------------------------------------------


SetChartBkGradientFill( ParamColor("BgTop", colorDarkOliveGreen),ParamColor("BgBottom", colorDarkGrey));
pShowtradeLines = ParamToggle("Show Trade Lines", "No|Yes", 1);
Volmin=Param("Volume minimum",5000,0,10000000,50);
Volmax=Param("Volume maximum",1000000,0,10000000,50);
priceRL=Param("Price Range Min",150,1,20000,1);
priceRH=Param("Price Range Max",3000,1,20000,1);
BSPeChMi=-25;//Param("Percentage Change Min set", -25, -100, 100, 0.1);
BSPeChMa=25;//Param("Percentage Change Max set", 25, -100, 100, 0.1);
BSPerTkProf=0.6;//Param("Take Profit Percent Set",0.6,0.3,30,0.1);
BSPerStLos=0.25;//Param("StopLoss Percent Set",0.25,0.2,5,0.1);


Bars = 0;
xpdh = 90;

{
BSPl_Rng = (TimeNum() >= 90000 AND TimeNum()<= 153000) AND (DateNum()==LastValue(DateNum()));
BSFH_Rg = (TimeNum() >= 090000 AND TimeNum()<= 093000) AND (DateNum()==LastValue(DateNum()));

BSFH_Prc = High * BSFH_Rg;
BSFH_Mrk = BarsSince(BSFH_Rg>0);
Num_Bars = 36000 / Interval(1);

TimeFrameSet(inDaily);
TOP_ = Open;
PDH_ = Ref(High,-1);
PDL_ = Ref(Low,-1);
PDO_ = Ref(Open,-1);
PDC_ = Ref(Close,-1);
PDM_ = (PDH_+PDL_)/2;
TimeFrameRestore();

isAll = True;
isRth = TimeNum() >= 085400 AND TimeNum() <= 093000;
isdRth = TimeNum() >= 085400 AND TimeNum() <= 160000;

aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd =IIf(isdRth, L, 1000000);

TOP = TimeFrameExpand(TOP_,inDaily,expandFirst);
PDH = TimeFrameExpand(PDH_,inDaily,expandFirst);
PDL = TimeFrameExpand(PDL_,inDaily,expandFirst);
PDO = TimeFrameExpand(PDO_,inDaily,expandFirst);
PDC = TimeFrameExpand(PDC_,inDaily,expandFirst);
PDM = TimeFrameExpand(PDM_,inDaily,expandFirst);
FHH = Ref(HHV(High*BSFH_Rg,Num_Bars),-BSFH_Mrk);
FHL = TimeFrameCompress( aRthL, inDaily, compressLow );
FHL = TimeFrameExpand( FHL, inDaily, expandFirst );
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );


FC1=((PDH-PDL)*0.433);
FC2=((PDH-PDL)*0.7666);
FC3=((PDH-PDL)*1.355);
FC4=(FHH-FHL);

A=IIf((FC4<=FC1+PDH*0.005),FC1,0);
B=IIf((FC4<=FC2+PDH*0.005 AND FC4>FC1+PDH*0.005),FC2,0);
Cl=IIf((FC4<=FC3 AND FC4>FC2+PDH*0.005),FC3,0);
AF=(A+B+Cl);

HaC =(O+H+L+C)/4;
HaO = AMA( Ref( HaC, -1 ), 0.5 );
HaH = Max( H, Max( HaC, HaO) );
HaL = Min( L, Min( HaC, HaO) );
BG3=HHV(LLV(HaL,4)+ATR(4),8);
BR3=LLV(HHV(HaH ,4)-ATR(4),8);
co = IIf(Hac>BG3 ,colorBlue,IIf(Hac < BR3,colorRed,colorGrey50));

BuyPrice=(DayL+AF);
BSByTP1=(BuyPrice+(BuyPrice*(BSPerTkProf/100)));
BSByTP2=(C>=BSByTP1);
SellPrice=(DayH-AF);
BSSlTP1=(SellPrice-(SellPrice*(BSPerTkProf/100)));
BSSlTP2=(C<=BSSlTP1);
BSPrCh=(((C-TOP)/TOP)*100);
Vol=(V>=Volmin AND V<=Volmax);
Percentage=(BSPrCh>=BSPeChMi AND BSPrCh<=BSPeChMa);
prc=(C>=priceRL AND C<=priceRH);
BuyStop1=(BuyPrice-(BuyPrice*(BSPerStLos/100)));
BuyStop2=IIf((BuyStop1<=SellPrice) AND SellPrice<=BuyPrice,SellPrice,BuyStop1);
SellStop1=(SellPrice+(SellPrice*(BSPerStLos/100)));
SellStop2=IIf((SellStop1>=BuyPrice) AND SellPrice<=BuyPrice, BuyPrice,SellStop1);

BuyStop=IIf((Buy AND NOT BSByTP2),BuyStop2,Null);
BuyTP=IIf(Buy AND NOT BuyStop,BSByTP2,Null);

Bars = BarsSince(TimeNum() >= 85400 AND TimeNum() < 092900);
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
TOP_Line = LineArray(x0,LastValue(TOP),x1,LastValue(TOP),0);
PDH_Line = LineArray(x0,LastValue(PDH),x1,LastValue(PDH),0);
PDL_Line = LineArray(x0,LastValue(PDL),x1,LastValue(PDL),0);
PDC_Line = LineArray(x0,LastValue(PDC),x1,LastValue(PDC),0);
PDM_Line = LineArray(x0,LastValue(PDM),x1,LastValue(PDM),0);
FHH_Line = LineArray(x0,LastValue(FHH),x1,LastValue(FHH),0);
FHL_Line = LineArray(x0,LastValue(FHL),x1,LastValue(FHL),0);
BuyPriceline=LineArray(x0,LastValue(BuyPrice),x1,LastValue(BuyPrice),0);
BuyStopline=LineArray(x0,LastValue(BuyStop2),x1,LastValue(BuyStop2),0);
BuyTPline=LineArray(x0,LastValue(BSByTP1),x1,LastValue(BSByTP1),0);
SellPriceline=LineArray(x0,LastValue(SellPrice),x1,LastValue(SellPrice),0);
SellStopline=LineArray(x0,LastValue(SellStop2),x1,LastValue(SellStop2),0);
SellTPline=LineArray(x0,LastValue(BSSlTP1),x1,LastValue(BSSlTP1),0);
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue(DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue(DayL),0);


Plot(IIf(pShowtradeLines,BuyStopline,Null),"",colorBrightGreen,styleDots|styleNoRescale| styleNoLine);
Plot(IIf(pShowtradeLines,SellPriceline,Null),"",colorRed,styleDots|styleNoRescale);

if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "BuySell system " + " - " + Name() + " - " + EncodeColor(colorYellow)+ Interval(2) + EncodeColor(colorYellow) +
" - " + Date() +" - "+ EncodeColor(colorYellow) + "Open = "+EncodeColor(colorWhite)+WriteVal(O,8.2) + EncodeColor(colorYellow) + ", High = "+EncodeColor(colorWhite)+ WriteVal(H,8.2)+ EncodeColor(colorYellow) + ", Low= "+EncodeColor(colorWhite)+ WriteVal(L,8.2)+ EncodeColor(colorYellow) + ", Close= "+EncodeColor(colorWhite)+ WriteVal(C,8.2)+ EncodeColor(colorYellow) + ", Vol= "+EncodeColor(colorWhite)+ WriteVal(V,1)+("\n")
);



//---------------------------------------------------------------------------------------------------------------------
GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorLightBlue, 2 );
GfxSelectSolidBrush( colorBlack );
GfxRoundRect( 5,65, 250, 180, 16, 20 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 12, 700, False );
GfxSetTextColor( colorBrown );
GfxSetTextAlign(0);
GfxSetTextColor( colorPaleGreen );
GfxTextOut( WriteIf(BuyPrice, "Long Target 1: "+WriteVal(BuyPrice,1.2),""),15, 73);
GfxSetTextColor( colorLightBlue );
GfxTextOut( WriteIf(BSByTP1 , "Long Target 2: "+WriteVal(BSByTP1,1.2),""), 15, 92);
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(SellPrice, "Short Target 1: "+WriteVal(SellPrice,1.2),""), 15, 111);
GfxSetTextColor( colorOrange );
GfxTextOut( WriteIf(BSSlTP1, "Short Target 2: "+WriteVal(BSSlTP1,1.2),""), 15, 129);
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf(BuyStopline, "Instant Sup/Res: "+WriteVal(BuyStopline,1.2),""), 15, 147);
}


//-------------------------------------------------------------------------------------------------------------------------

CHA= (O+H+L+C)/4;
OHA = AMA( Ref( CHA,-2 ), 0.5 );
HAH = Max( H, Max( CHA,OHA ) );
HAL = Min( L, Min( CHA,OHA ) );
BG2=HHV(LLV(Low,4)+ATR(4),8);
BR2=LLV(HHV(High,4)-ATR(4),8);
k = Optimize("K",1.75,1,5,0.25);
Per =Optimize("A",10,3,30,1);
j=CHA;
nm=(H-L);
rfsctor = WMA(nm, 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];
}
}
}
}

Plot(NW,"",IIf(Trend ==1,6,4),4);

Buy=Cross(j,nw);
Short=Cross(nw,j);
Sell=Cross(nw,j);
Cover=Cross(j,nw);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );

dist = 1.5*ATR(15);
Buy2show=0;
Sell2show=0;
for( i = 0; i < BarCount; i++ )
{
if( Buy )
{
PlotText( "Buy@" +WriteVal( L[ i],1.2), i-5, L[ i ]-Trend, colorWhite, colorBlue);
Buy2show=L;
}

if( Sell )
{
PlotText( "Sell@" +WriteVal (H[ i ],1), i-5, L[ i ]+Trend, colorWhite, colorRed );
Sell2show=H[ i ];
}
}
AlertIf(Sell,"SOUND C:\\Windows\\Media\\Ding.wav","Sell@" + WriteVal( H,1.2) ,2);
AlertIf(Buy,"SOUND C:\\Windows\\Media\\Ding.wav","Buy@" + WriteVal( O,1.2),1);

GfxSetBkMode(transparent=1);
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorRGB (217,217,213));
GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.4 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxTextOut( "From", Status("pxwidth")/C14*1.8, Status("pxheight")/C15*10.5 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.45 );
GfxSetTextColor( colorWhite);
GfxTextOut( " www.buysellnifty.com ", Status("pxwidth")/C14*1.8, Status("pxheight")/C15*11 );
GfxSelectFont("MS Sans Serif", 10, 500, False, False, 0);

//----------------------------------------------------------------------------------------------

//---------------------------
//to plot buysell price
GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorGreen, 2 );
GfxSelectSolidBrush( colorBlack );
GfxRoundRect( 5, 181,250,240, 15, 15 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 12, 700, False );
GfxSetTextColor( colorPaleGreen );
GfxSetTextAlign(0);




bf=(H-B);
SF=(O-L);

GfxTextOut( WriteIf(Buy OR Long , "BUY Signal At = "+WriteVal(Buy2show,1.2),""), 10, 185);
GfxTextOut( WriteIf(Sell OR shrt , "SELL Signal At = "+WriteVal(Sell2show,1.2),""),10, 185);


GfxSetTextColor( colorYellow );
GfxTextOut( WriteIf( Long AND NOT Buy, "BUY Profit = "+WriteVal(C-Buy2show,1.2 ),""),10, 205);
GfxTextOut( WriteIf( shrt AND NOT Sell, "SELL Profit = "+WriteVal(Sell2show-C,1.2 ),""),10, 205);
//GfxTextOut( WriteIf(Long OR shrt , "CMP = "+WriteVal(C,1.2),""),10, 215);



//-----------------------------------------------------------------------------------------------------

GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorOrange, 2 );
GfxSelectSolidBrush( colorBlack );
GfxRoundRect(5,20, 250,63, 16, 20 );
GfxSetBkMode(1);
GfxSelectFont( "Arial",12, 700, False );
GfxSetTextColor( colorPaleGreen );
GfxSetTextAlign(0);

GfxSetTextColor( colorYellow );
GfxTextOut(WriteIf(SellPrice, "TREND REVERSAL: "+(SellPrice),""), 8 ,25 );

GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(nw, " Trailing SL : "+WriteVal(nw,1),""), 8, 43);
GfxTextOut( WriteIf(Cover AND NOT Buy ," Trailing SL : "+WriteVal(nw,1 ),""),8, 43);
GfxSetTextColor( colorGold );
GfxTextOut( WriteIf(nw, " Trailing SL : "+WriteVal(nw,1),""), 8, 43);
GfxTextOut( WriteIf( Short AND NOT Sell," Trailing SL : "+WriteVal(nw,1 ),""),8, 43);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,HAL,-40);

PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,HAH,-40);

//-----------------------------------------------------------------------------

fibs = ParamToggle("Plot Fibs","Off|On",1);
pctH = 0.325;//Param ("Pivot Hi %", 0.325,0.001,2.0,0.002);
HiLB = 1;//Param ("Up LookBack",1,1,BarCount-1,1);
pctL = 0.325;//Param ("Pivot Lo %", 0.325,0.001,2.0,0.002);
LoLB = 1;//Param ("Down LookBack",1,1,BarCount-1,1);
Back = 1;//Param ("Extend Left = 2",1,1,500,1);
Fwd = 0;//Param("Plot Forward", 0, 0, 500, 1);
text = ParamToggle("Plot Text","Off|On",1);
hts = -14;//Param ("Text Shift", -14,-50,50,0.10);
style = ParamStyle("Line Style",styleLine,styleNoLabel);
x =BarIndex();
pRp = PeakBars( H, pctH, 1) == 0;
yRp0 = LastValue(ValueWhen( pRp, H, HiLB));
xRp0 = LastValue(ValueWhen( pRp, x, HiLB));
pSp = TroughBars( L, pctL, 1) == 0;
ySp0 = LastValue(ValueWhen( pSp, L, LoLB));
xSp0 = LastValue(ValueWhen( pSp, x, LoLB));
Delta = yRp0 - ySp0;

function LFI(ret)
{
retval = (Delta * ret);
LFIVal = IIf(ret < 1.0
AND xSp0 < xRp0, yRp0 - retval, IIf(ret < 1.0
AND xSp0 > xRp0, ySp0 + retval,IIf(ret > 1.0
AND xSp0 < xRp0, yRp0 - retval, IIf(ret > 1.0
AND xSp0 > xRp0, ySp0 + retval, Null))));
return LFIVal;
}


xo=Min(xSp0,xRp0)-Back;
x1=BarCount-1;
//////////////////////////////////////////////////////////////////
r236 = LFI(0.236); r236I = LastValue (r236,1);
r382 = LFI(0.382); r382I = LastValue (r382,1);
r050 = LFI(0.50); r050I = LastValue (r050,1);
r618 = LFI(0.618); r618I = LastValue (r618,1);
r786 = LFI(0.786); r786I = LastValue (r786,1);
e127 = LFI(1.27); e127I = LastValue (e127,1);
e162 = LFI(1.62); e162I = LastValue (e162,1);
e200 = LFI(2.00); e200I = LastValue (e200,1);
e262 = LFI(2.62); e262I = LastValue (e262,1);
e424 = LFI(4.24); e424I = LastValue (e424,1);
//////////////////////////////////////////////////////////////////
p00 = IIf(xSp0 > xRp0,ySp0,yRp0); p00I = LastValue (p00,1);
p100 = IIf(xSp0 < xRp0,ySp0,yRp0); p100I = LastValue (p100,1);
color00 =IIf(xSp0 > xRp0,colorLime,colorRed);
color100 =IIf(xSp0 < xRp0,colorLime,colorRed);
//////////////////////////////////////////////////////////////////
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
//////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////
if(text==1)
{
PlotText(" 0% = " + WriteVal(p00,1), LastValue(BarIndex())-(numbars/hts), p00I + 0.05, color00);
PlotText("23% = " + WriteVal(r236,1), LastValue(BarIndex())-(numbars/hts), r236I + 0.05, color00);
PlotText("38% = " + WriteVal(r382,1), LastValue(BarIndex())-(numbars/hts), r382I + 0.05, color00);
PlotText("50% = " + WriteVal(r050,1), LastValue(BarIndex())-(numbars/hts), r050I + 0.05, color00);
PlotText("62% = " + WriteVal(r618,1), LastValue(BarIndex())-(numbars/hts), r618I + 0.05, color00);
PlotText("78% = " + WriteVal(r786,1), LastValue(BarIndex())-(numbars/hts), r786I + 0.05, color00);
PlotText("100% = " + WriteVal(p100,1), LastValue(BarIndex())-(numbars/hts),p100I + 0.05, color00);
PlotText("127% = " + WriteVal(e127,1), LastValue(BarIndex())-(numbars/hts),e127I + 0.05, color00);
PlotText("162% = " + WriteVal(e162,1), LastValue(BarIndex())-(numbars/hts),e162I + 0.05, color00);
PlotText("200% = " + WriteVal(e200,1), LastValue(BarIndex())-(numbars/hts),e200I + 0.05, color00);
PlotText("262% = " + WriteVal(e262,1), LastValue(BarIndex())-(numbars/hts),e262I + 0.05, color00);
PlotText("424% = " + WriteVal(e424,1), LastValue(BarIndex())-(numbars/hts),e424I + 0.05, color00);
}


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

YH = TimeFrameGetPrice("H", inDaily, -1); // yesterdays high
YL = TimeFrameGetPrice("L", inDaily, -1); // low
YC = TimeFrameGetPrice("C", inDaily, -1); // close
YO = TimeFrameGetPrice("O", inDaily); // current day open

//Normal Pivot
PP = (YH + YL + YC) / 3;
R1 = (2 * PP) - YL;
R2 = PP + (YH - YL);
R3 = YH + 2*(PP-YL);
S1 = (2 * PP) - YH;
S2 = PP - (YH - YL);
S3 = YL - 2*(YH - PP) ;
// -----------------------------------------------------------------------------------
_SECTION_END();
 

Similar threads