Time based trading nift and banknifty

sangram1705

Well-Known Member
plot 7 days back histogram for today.average of 1st week and 2ndweek back from today.
I am getting the following parameters with these default values.

Key MA period 120
PowerZone false
AMACD false
ACCI false
Astoch false
ADoubleStoch false
Minutes in advance 0
MACDFast 5
MACDSlow 20
CCI period 30
Kperiod 35
Dperiod 7
Max Days Back 60

Can you please guide me, what these settings should be to get the correct histogram. (I am aware that you are using ninja & u have also admitted that u have no idea of mt4). Still I think you will be able to guide.
Thanks
 

casoni

Well-Known Member
Hello,
This is what i did , but i am not getting the desire result... ,
maybe this needs to be coded in some different way . please check and give your views for corrections, so that this can be finalized..

Code:
/*
it is based on macd last two weeks same time and plots a histogram
this is derived from idea of all big players place same time every day.
those big lots only effects markets

2 weeks
beyond 2 weeks no use
you can select upto 8 weeks

timings on top means down bottom means up.
zereo line must cross smoothly. if there is gap there is chance of reversal.
exit there renter latter depending on trend.
trend is always your friend.this is TIMELY HELPING FRIEND.

plot 7 days back histogram for today.average of 1st week and 2ndweek back from today.

*/

SetChartBkColor(colorblack);SetChartOptions(0,chartShowDates);
function fMacdHisto( input, f0, f1, f2 ) 
{ 
	mymacd = EMA(input,f0) - EMA(input,f1);
	mymacdsig = EMA(mymacd,f2);

	result = mymacd - mymacdsig;

   return result; 
}
bars=0;
 if (Interval()==in1minute) {bars = 376;}  
 if (Interval()==in5minute) {bars = 76 ;}
 if (Interval()==in15minute) {bars = 26 ; } 
XXy=Param("past day",7,1,40,1);
priceA = ref(C,-bars*xxy);
MA1	= Param("Fast",5,2,130,1);
MA2 = Param("slow",20,5,150,1);
MA3 = Param("sIG",20,2,90,1);

Mh   = fMacdHisto( priceA, MA1, MA2, MA3);
color=IIf(mh>0,5,4);
Plot( mh , "MACD Histogram",Color,  ParamStyle( "Histogram style", styleHistogram | styleThick , maskHistogram ) );

a=Cross(mh,0);// bullish
b=Cross(0,mh); //beaqrish
ax=Flip(a,b); 
ay=Flip(b,a); 
Up =ExRem(a, b);
Dn =ExRem(b, a);
xx=BarIndex();Lx=LastValue(xx);  
PLBars  = IIf(Up, LowestSinceBars(Dn, mh ,1),0); //find the bar that produced the Lowest Low
PHBars  = IIf(Dn, HighestSinceBars(Up,mh, 1),0); //find the bar that produced the Highest High
PLPrice = IIf(Up, Ref(mh, -pLBars), 0);
PHPrice = IIf(Dn, Ref(mh, -pHBars),0);

pk=mh==ValueWhen(PHBars,Ref(mh,-PHBars),0);
//PlotShapes(shapeSmallCircle*pk,ColorRGB(255,0,0),0,mh,10);
tr=mh==ValueWhen(PLBars,Ref(mh,-PLBars),0);
//PlotShapes(shapeSmallCircle*tr,ColorRGB(0,100,0),0,mh,-10);


dt=Ref(DateTimeConvert( 2, Datenum() ),-bars*xxy); //dt
Rve=Ref(DateTimeConvert(1, DateTime()  ),-bars*xxy);//hour

 
fvb=Status("firstvisiblebarindex"); 
lvb=Min(Lx,Status("lastvisiblebarindex")); 
Font= ParamList("Font:","Arial|Berlin Sans FB|Book Antiqua|Candara|Calibri|Tahoma|Times New Roman|Engravers MT| ",5);
Vd         = ParamToggle("Show pK-tr","No|Yes" ,1);
Ve         = ParamToggle("Show 0 cross","No|Yes" ,0);
for(i=fvb;i<lvb;i++)  
{ 

    if(pk[i]AND Vd) PlotTextSetFont("S:"+DateTimeToStr( dt [ i ] )+"\n"+Rve[i],Font,8,i,mh[i],colororange,colorDefault,20);  
    if(tr[i]AND Vd) PlotTextSetFont("L:"+DateTimeToStr( dt [ i ] )+"\n"+Rve[i],Font,8,i,mh[i],colorpaleGreen,colorDefault,-20);  
   
    if(up[i] AND Ve) PlotTextSetFont(""+DateTimeToStr( dt [ i ] )+"\n"+Rve[i],Font,8,i,mh[i],colorGreen,colorDefault,20);  
    if(dn[i] AND Ve) PlotTextSetFont(""+DateTimeToStr( dt [ i ] )+"\n"+Rve[i],Font,8,i,mh[i],colorGreen,colorDefault,-20);  
   
   
}   
strWeekday = StrMid("SunMonTueWedThuFriSat", SelectedValue(DayOfWeek())*3,3);
Title = 
EncodeColor(colorWhite)+ "" + " - " +  Name() + " - " + "Time base"+
/* " | " + EncodeColor(colorLime)+ Interval(2) + EncodeColor(colorWhite) + "  #  "+strWeekday +" , "+ Date()+
"\n"+EncodeColor(colorYellow) +"Op -"+O+" : "+EncodeColor(colorLime)+"Hi-"+H+" :  "+EncodeColor(colorOrange)+"Lo-"+L+"  : "+EncodeColor(colorWhite)+ "Cl-"+C+" : "+EncodeColor(colorYellow)+ "Vol= "+ WriteVal(V/1000)+
encodecolor( colorPink)+"\n"+*/
"\n"+"Days Back : "+xxy;
Thank you
 

mt4trader

Well-Known Member
thanks casoni you explained better than me in simple language.
i know mt4 but not about this indicator.
this week i will install amibroker (before i used to spend lot of time with it when amibrokerfans JET. latter stopped)
i will compare with ninja and see what modification is to be done.
if we develop for amibroker more healpfull for traders.
i will extened all my cooperation
 

Similar threads