Simple Coding Help - No Promise.

Hello Ravi

This is just a quick patch up, try it and maybe you will be able to modify it to suit your exact requirements,

Code:
MyTF	=	Param("Time Frame in Minutes",15,1,60*24,1);
TimeFrameSet(in1Minute*MyTF);
e3  = EMA(C,3);	e15 = EMA(C,15);	e34 = EMA(C,34);	e100= EMA(C,100);
Xe3  = H > e3  AND L < e3;  	Xe15 = H > e15  AND L < e15;
Xe34 = H > e34 AND L < e34; 	Xe100= H > e100 AND L < e100;
Be3  = BarsSince(xe3);	Be15 = BarsSince(xe15);
Be34 = BarsSince(xe34);	Be100= BarsSince(xe100);
TimeFrameRestore();
e3Bars 	=	TimeFrameExpand(Be3,in1Minute*MyTF);
e15Bars	=	TimeFrameExpand(Be15,in1Minute*MyTF);
e34Bars	=	TimeFrameExpand(Be34,in1Minute*MyTF);
e100Bars	=	TimeFrameExpand(Be100,in1Minute*MyTF);
GfxSetOverlayMode(0);	GfxSetBkMode(2);
GfxSelectFont("Comic Sans MS",10,600);
GfxSetBkColor( colorBlack);	GfxSetTextColor(colorBrightGreen);
GfxDrawText("TIME FRAME: " + NumToStr(MyTF,2.0) + " Minutes ",10,15, 1150, 50, 0);
GfxDrawText( "EMA 03: " + NumToStr(e3Bars,2.0)  + " Bars,  EMA 15: "  + NumToStr(e15Bars,2.0)  + " Bars ",10,30, 1150, 50, 0);
GfxDrawText( "EMA 34: " + NumToStr(e34Bars,2.0) + " Bars,  EMA 100: " + NumToStr(e100Bars,2.0) + " Bars ",10,45, 1150, 75, 0);
If you need any further modifications, will be able to do so only next week . . .

Cheers

:) Happy

can try this another version also

Code:
GfxSetOverlayMode(0);	GfxSetBkMode(2);
GfxSelectFont("Comic Sans MS",10,600);
GfxSetBkColor( colorBlack);	GfxSetTextColor(colorBrightGreen);
MyTF	=	Param("Time Frame in Minutes",15,1,1440,1);
TimeFrameSet(in1Minute* MyTF);
	e3  = EMA(C,3);	e15 = EMA(C,15);	e34 = EMA(C,34);	e100= EMA(C,100);
	Xe3  = H > e3  AND L < e3;  	Xe15 = H > e15  AND L < e15;
	Xe34 = H > e34 AND L < e34; 	Xe100= H > e100 AND L < e100;
	Be3  = BarsSince(xe3);	Be15 = BarsSince(xe15);
	Be34 = BarsSince(xe34);	Be100= BarsSince(xe100);
	GfxDrawText("TIME FRAME: " + NumToStr(MyTF,3.0) + " Minutes ",10,15, 1150, 50, 0);
	GfxDrawText( "EMA 03: " + NumToStr(Be3,2.0)  + " Bars,  EMA 15: "  + NumToStr(Be15,2.0)  + " Bars ",10,30, 1150, 50, 0);
	GfxDrawText( "EMA 34: " + NumToStr(Be34,2.0) + " Bars,  EMA 100: " + NumToStr(Be100,2.0) + " Bars ",10,45, 1150, 75, 0);
TimeFrameRestore();
 
Last edited:

amitrandive

Well-Known Member
Happy Singh

Can you please make an AFL and exploration to plot and alert on Higher low's and Lower High's .

It should also display all the pivots Higher high,Higher Low, Lower Low and Lower High.

Preferably on an EOD basis.

Thanks
Amit
 
Happy Singh

Can you please make an AFL and exploration to plot and alert on Higher low's and Lower High's .

It should also display all the pivots Higher high,Higher Low, Lower Low and Lower High.

Preferably on an EOD basis.

Thanks
Amit
HH, LL, LH & HL part is easy,

Code:
_SECTION_BEGIN("ZigZag");
P = Param("ZigZag_Percent",0.1,0.01,2,0.01);
ZigH  = Zig(H,P);		ZigL = Zig(L,P);
ZigHi = ZigH > Ref(ZigH,-1) AND ZigH > Ref(ZigH,1);		
ZigLo = ZigL < Ref(ZigL,-1) AND ZigL < Ref(ZigL,1);
j=0;	k=0;	PH[0] = PL[0] = 0;
for( i = 1; i < BarCount-1; i++ ) { 
 if (ZigLo[i])	{
	if (PL[k] > ZigL[i])  	PlotText("LL",i, L[i]-5, colorLime);
	else						PlotText("HL",i, L[i]-5, colorBlueGrey);
	k = k + 1;		PL[k] = ZigL[i]; }
 if (ZigHi[i]) {
	if (PH[j] < ZigH[i])  	PlotText("HH", i, H[i]+5, colorBlueGrey);
	else						PlotText("LH", i, H[i]+5, colorLime);
	j = j + 1;
	PH[j] = ZigH[i]; }
}
_SECTION_END();
Avoid using exploration on this as it uses zig and ZigZag is forward looking . . . so takes 3/4 bars for the signals to stabilize . . .
 

dell

Well-Known Member
happy ji ,a small request , if u get time plz post an example or a link for an afl for
if a condition satisfied than buy triggered ......
again if certain condition satisfied add position trigerrs .....
again if certain condition satisfied add positions triggers
if certain condition satisfied than exit partial position's.....
again if certain condition satisfied than close all position's............

wanna to learn , so any example will help me in tweaking my ideas , if i failed than again i disturbs u ......bcaz u r " happy " to help and to make all others "happy"................
 
Last edited:
Dear happy sir
if u have little time please write one afl conditions

if in hourly macd>0 then (big trend)
i want on every day after 15 min candle high cross of price buy signal

Thanks
Abhishek
 

pratapvb

Well-Known Member
happy ji ,a small request , if u get time plz post an example or a link for an afl for
if a condition satisfied than buy triggered ......
again if certain condition satisfied add position trigerrs .....
again if certain condition satisfied add positions triggers
if certain condition satisfied than exit partial position's.....
again if certain condition satisfied than close all position's............

wanna to learn , so any example will help me in tweaking my ideas , if i failed than again i disturbs u ......bcaz u r " happy " to help and to make all others "happy"................

Buy = <condition for buy> ;
Short = <condition for short> ;

add1 = <cond for add1> ;
add2 = <cond for add2> ;

coverpar = <part exit for short> ;
sellpar = <part exit for buy> ;

Cover = <exit for short> ;
Sell = <exit for Buy> ;

if condition is such that multiple bars gives signal like say MACD > 0 will be satisfied for all bars as long as above zero, then duplicates can be removed upto a particular condition using ExRem like

Cover = Exrem(Cover, Short) ;
Sell = Exrem(Sell, Buy) ;

Buy = Exrem(Buy, Short or Sell or Sellpar) ;
Short = Exrem(Short, Buy or Cover or Coverpar) ;

and so forth....

not sure if this is what you wanted.
 

amitrandive

Well-Known Member
HH, LL, LH & HL part is easy,

Code:
_SECTION_BEGIN("ZigZag");
P = Param("ZigZag_Percent",0.1,0.01,2,0.01);
ZigH  = Zig(H,P);		ZigL = Zig(L,P);
ZigHi = ZigH > Ref(ZigH,-1) AND ZigH > Ref(ZigH,1);		
ZigLo = ZigL < Ref(ZigL,-1) AND ZigL < Ref(ZigL,1);
j=0;	k=0;	PH[0] = PL[0] = 0;
for( i = 1; i < BarCount-1; i++ ) { 
 if (ZigLo[i])	{
	if (PL[k] > ZigL[i])  	PlotText("LL",i, L[i]-5, colorLime);
	else						PlotText("HL",i, L[i]-5, colorBlueGrey);
	k = k + 1;		PL[k] = ZigL[i]; }
 if (ZigHi[i]) {
	if (PH[j] < ZigH[i])  	PlotText("HH", i, H[i]+5, colorBlueGrey);
	else						PlotText("LH", i, H[i]+5, colorLime);
	j = j + 1;
	PH[j] = ZigH[i]; }
}
_SECTION_END();
Avoid using exploration on this as it uses zig and ZigZag is forward looking . . . so takes 3/4 bars for the signals to stabilize . . .
Happy Singh ,
Thanks for AFl and advice to avoid exploration:clapping:
 

Similar threads