General Trading Chat

XRAY27

Well-Known Member
Below is the today chart above plane is of pratap sir ATR daily for range calculations (in his terms "Noice zone") ,VAH POC VAL as per MP...,is second plane

AFL for first plane : created by Pratap sir,
_SECTION_BEGIN("Price");
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("Range");

SetChartOptions(2,chartWrapTitle);

TimeFrameSet(inDaily);
ATRdaily = ATR(7) ;
TimeFrameRestore() ;
ATRdaily = TimeFrameExpand(ATRdaily,inDaily);

TimeFrameSet(inDaily);
noise = Min(H-O,O-L);
expansion = Max(H-O,O-L);
range = H-L;

Avg1 = Param("Avg Period 1", 10, 1, 1000) ;
Avg2 = Param("Avg Period 1", 20, 1, 1000) ;
Clrnb = Clrnoise = ParamColor("Color Noise", colorLightOrange) ;

Layer = Param("Layer", -1, -5, 5) ;
showfill = ParamToggle("Show Fill", "No|Yes", 1) ;
showext = ParamToggle("Show Extension", "No|Yes", 1) ;
extend = Param("Extend By", 5, 0, 200, 1) ;
xst = BarCount - (extend) +1 ;
xed = BarCount -1 ;

showtext = ParamToggle("Show Text", "No|Yes", 1) ;
txtpos = BarCount + extend-5 ;
fil = Param("Text Filter", 1, 1, 10000, 1) ;

showoncrb = ParamToggle("Show On CRB", "No|Yes", 0) ;
Refo = ParamField("CRB Open", 7+0) ;
Refh = ParamField("CRB High", 7+1) ;
Refl = ParamField("CRB Low", 7+2) ;
Refc = ParamField("CRB Close", 7+3) ;
Refbi = ParamField("CRB BI", 7+4) ;
Refcrbbars = ParamField("CRB Bars", 7+5) ;
Refnbars = ParamField("TF Bars", 7+6) ;
Refdt = ParamField("CRB DT", 7+7) ;


xnoise = MA(noise,Avg1);
xexpansion = MA(expansion,Avg1);
xdrange = MA(range, Avg1);

ynoise = MA(noise,Avg2);
yexpansion = MA(expansion,Avg2);
ydrange = MA(range,Avg2);

anoise = (xnoise + ynoise) / 2;
aexpansion = (xexpansion + yexpansion) / 2;
adrange = (xdrange + ydrange) / 2;
TimeFrameRestore();

anoise = TimeFrameExpand(anoise,inDaily);
aexpansion = TimeFrameExpand(aexpansion,inDaily);
adrange = TimeFrameExpand(adrange,inDaily);
ro = O ;
rh = H ;
rl = L ;
rc = C ;
dt = DateTime() ;
if (showoncrb)
{
ro = Refo ;
rh = Refh ;
rl = Refl ;
rc = Refc ;
dt = Refdt ;
}

a=Day()!=Ref(Day(),-1);
Lod = LowestSince(a,L);
Hod = HighestSince(a,H);

dopen = TimeFrameGetPrice("O",inDaily);
Refadnh = adnh = dopen+anoise ;
Refadnl = adnl = dopen-anoise ;
Refadeh = adeh = dopen+aexpansion ;
Refadel = adel = dopen-aexpansion ;
Refadrh = adrh = Lod+adrange ;
Refadrl = adrl = Hod-adrange ;

if (showoncrb)
{
diffbars = Refnbars -Refcrbbars -1 ;
Crbst = BarCount - LastValue(Refcrbbars) -1;

// convert to crb
Refadnh = Ref(adnh, -diffbars) ;
Refadnl = Ref(adnl, -diffbars) ;
Refadeh = Ref(adeh, -diffbars) ;
Refadel = Ref(adel, -diffbars) ;
Refadrh = Ref(adrh, -diffbars) ;
Refadrl = Ref(adrl, -diffbars) ;

k = 0 ;
for ( i = Crbst ; i < BarCount ; i++)
{
Refbar = Refbi;

Refadnh = adnh[Refbar] ;
Refadnl = adnl[Refbar] ;
Refadeh = adeh[Refbar] ;
Refadel = adel[Refbar] ;
Refadrh = adrh[Refbar] ;
Refadrl = adrl[Refbar] ;


k++;
}
}


Plot(Refadnh,"",colorBlack, styleNoRescale);
Plot(Refadnl,"",colorBlack, styleNoRescale);
doblend = True ;
Clrblend = colorWhite ;
if (doblend)
{
Clrnb = ColorBlend(Clrnoise, Clrblend) ;
}


if (showfill)
PlotOHLC(Refadnh, Refadnh, Refadnl, Refadnl, "", Clrnb,styleCloud |styleNoRescale,0,0,0, Layer) ;


showtrigger = ParamToggle("Show Trigger", "No|Yes", 0) ;
showsltrigger = ParamToggle("Show SL Trigger", "No|Yes", 0) ;


Buy = Cross(rC,Refadnh);
Short = Cross(Refadnl,rC);


Cover = Cross(rC,Refadnl);
Sell = Cross(Refadnh,rC);


//AlertIf(Buy,"","Buy"+Name());
//AlertIf(Sell,"","Sell"+Name());
if(showext)
{
Hdlast = SelectedValue(Refadnh) ;
Ldlast = SelectedValue(Refadnl) ;


Hplot = LineArray(xst, Hdlast, xed, Hdlast) ;
Plot(Hplot, "", Clrnoise, styleLine|styleDots|styleNoLabel|styleNoRescale , 0,0,extend) ;
if (showtext)
PlotText(NumToStr(HdLast, 8.1), txtpos, HdLast+fil, colorBlack) ;


LPlot = LineArray(xst, Ldlast, xed, Ldlast) ;
Plot(LPlot, "", Clrnoise, styleLine|styleDots|styleNoLabel|styleNoRescale , 0,0,extend) ;
if (showtext)
PlotText(NumToStr(LdLast, 8.1), txtpos, LdLast+fil, colorBlack) ;


PlotOHLC(HPlot, HPlot, LPlot, LPlot, "", Clrnb, styleCloud|styleNoLabel|styleNoTitle|styleNoRescale, 0,0,extend,Layer ) ;
}
PP.png
 

ncube

Well-Known Member
Welcome to real world of trading !!! This is what market baba is saying !!! if you lack any of the skill ,just be ready to pay back !!!!Any of the method that is known in trading world will not save us, until a method to spot girding markets !!! D and S along with MP i got saved lot of time but this time it has not worked !!!
It is generally assumed that index reflect the overall market sentiment, however I found that it is not completely true.
Index constituents are market cap weighted and few heavy weights can skew the index trend. I used to keep Nifty as my benchmark & filter
but this year Nifty did not shown clear co-relation to the general market and I am now sitting on cash with a 4% drawdown..:)

So I feel its better to have an index based filter along with our regular filters which can give us some sense of general market sentiment.
There are many innovative ways we can do it. One simple option is to recreate the index by giving equal weights to its constituents, which will represent all constituents equally and provide us a more clear picture. The way to read this is that if the index and our re-created index are trending
in the same direction then general sentiment is in sync and we can take trades in that direct with more confidence. If the trend contradict each
other give more weightage to the re-created index direction and take only selective trades.

There are other ways to re-create the index such as by using the index constituents daily returns, gainers/loser ratios, Crowd Sentiment factor etc
These are just my thinking, I am sure you guys can come up with many other creative ideas. In the evening if possible I will try to share an image of how I use the trend filter.
 

XRAY27

Well-Known Member

ncube

Well-Known Member
Attached below is the output from the sentiment filter algorithm that I have coded, it can be any such filter that is based on the concept of sentiment and the results would not be much different.

Last 2 year sentiment:
2yrs.png

We can see that small & midcap stocks were the first to start its downtrend right at around 15-01-2018 much before Nifty index reflected the change. Again there was a brief change in sentiment starting at 27-03-2018 lasting for about a month till 20-04-2018

Last 50 Days sentiment: (As of 06/07/2018)
50days.png


Even though Nifty Index trend is not clear, the sentiment trend is clearly down starting from 14-06-2018. Last couple of days the sentiment is neutral for Nifty,Largecap & Midcap which can form a bottom, but there is no bottom yet for small caps.

I have started rotating my funds in different segment stocks based on this filter as it gives my some rough guidance on which segment stocks to give higher priority and how much weightage I can give them. I plan to enter the market when the segment sentiment trend is moving up and comeout when it starts to go down.
 

Similar threads