Dynamice zone MACD ---CAN ANY ONE CONVERT INTO AFL...????

chintan786

Well-Known Member
#11
Thanks Ashutosh.. can u plz tell me wht settings i reuire to use this for Intraday trading purpose.
 

rvlv

Active Member
#13
Re: Dynamice zone ---please CONVERT INTO AFL...????

Hi Ashutosh jee


First
Thank you for your dynamiczone MACD afl.

Please extend your help to code the following indicators into amibroker formulae and oblige.

Dynamiczone ADX
ts code
------------------------------
Dynamic Zone Williams %R Indicator

PR:=Input("Enter Periods for W%R",1,100,14);
PB:=Input("Enter Periods for BUY",1,100,20);
PS:=Input("Enter Periods for SELL",1,100,20);
{CONVERT W%R TO +/-50 OSC}
DWR:=(Mov(WillR(PR),2,S))+50;
UpZone:=Mov(DWR,PS,S)+(1.3185 * Stdev(DWR,PS));
LwZone:=Mov(DWR,PB,S)-(1.3185 * Stdev(DWR,PB));
MidZone:=(UpZone + LwZone)/2;
MidZone;
UpZone;
LwZone;
DWR
-------------------------------------
TradeStation Code:
DYNAMICZONE ADX

Input: Ind(ADX(14)), N(35), StartPrB(0.12), StartPrS(0.12);
Vars: BuyZone(0), SellZone(0);
BuyZone=DZBuy(Ind, StartPrB, N);
SellZone=DZSell(Ind, StartPrS, N);
Plot1(Ind,"Indicator");
Plot2(SellZone,"ADX Level");





----------------------------------
ms code

1-2-3 Reversal System

Enter Long:

(Ref(C,-2) < Ref(C,-1)) AND
(Ref(C,-1) < C) AND
(Ref(Stoch(9,3),-1) < Stoch(9,3)) AND
(Mov(Stoch(9,3),3,S) < 50)


Enter Short:

(Ref(C,-2) > Ref(C,-1)) AND
(Ref(C,-1) > C) AND
(Ref(Stoch(9,3),-1) > Stoch(9,3)) AND
(Mov(Stoch(9,3),3,S) > 50)
==================================

With advance thanks
rvlv
 
#15
Re: Dynamice zone ---please CONVERT INTO AFL...????

Hi Ashutosh jee


First
Thank you for your dynamiczone MACD afl.

Please extend your help to code the following indicators into amibroker formulae and oblige.

Dynamiczone ADX
ts code
------------------------------
Dynamic Zone Williams %R Indicator

PR:=Input("Enter Periods for W%R",1,100,14);
PB:=Input("Enter Periods for BUY",1,100,20);
PS:=Input("Enter Periods for SELL",1,100,20);
{CONVERT W%R TO +/-50 OSC}
DWR:=(Mov(WillR(PR),2,S))+50;
UpZone:=Mov(DWR,PS,S)+(1.3185 * Stdev(DWR,PS));
LwZone:=Mov(DWR,PB,S)-(1.3185 * Stdev(DWR,PB));
MidZone:=(UpZone + LwZone)/2;
MidZone;
UpZone;
LwZone;
DWR
-------------------------------------

rvlv
Sorry rvlv,
was not in town.
please try the attached afl for DWR for now. Will try to convert more.
regards
ashutosh
 
Last edited:

hitesh

Active Member
#17
Hello Ashutosh ji,

Thanks a lot..... Nice coding of Dynamic Zone MACD and W%R.

Can U help to code Dynamic Zone ADX Please ??

Thanks
Hitesh
 
#19
can anyone please convert this tradestation code to amibroker
This is a tradestatoion code for function DZBUY
Code:
[LegacyColorValue = true]; 

{User Function: DZBuy

Return:    The value of the Upper Bound such that Probability of a given indicator
	to be above this bound is equal to the given probability +- given accuracy.

Example. Indicator's values are 1, 2, 3, 4, 5, 6, 7, 8, 9, 9.  The Probability required is
	0.2 with an accuracy 0.05. Then the Upper bound for this indicator will be 8.  
	The Probability that the indicator is above 8 is equal 0.2 with the accuracy 
	0.05 because if it is 7 then the Probability is 0.30 and it is out of bounds.

Provided by: RINA Systems, Inc.

!!The only place to be changed here is the default value for the variable BNumb!!}


Input: Indictor(NUMERICSERIES), InitVal(NUMERIC), N(NUMERIC);

Vars: Left(-10000), Right(10000),count(0),j(0),j1(0),Prob(0),eps(0.001),yval(0),k(0),delt(0),
BNumb(35775),BNumb1(30208);
array: return[750](0);

{Right is the value of the indicator that serves as a high above which the probability is within
the bounds}

{If 1=1 {and (BlockNumber=BNumb or BlockNumber=BNumb1)} and  CurrentDate <20000306 then
begin}
	value5=Indictor;

	If BarNumber>N then
	begin
		For k=0 to N-2
		begin
			return[k]=return[k+1];
		end;
		return[N-1]=value5;
	end
	else
	begin
		j=BarNumber-1;
		return[j]=value5;
	end;
	If BarNumber>=N then
	begin 
		yval=(left+right)/2;
		delt=yval-left;
		while delt>0.005 and value1<50
	 	begin
			value1=value1+1;
			For j1=0 to N-1
			begin
				IF return[j1]<yval then
				begin
					count=count+1;
				end;
			end;
			Prob=count/N;
		
			IF Prob>InitVal+eps then
			begin
				right=yval;
				yval=(yval+left)/2;
			end;
			IF Prob<InitVal-eps then
			begin
				left=yval;
				yval=(yval+right)/2;
			end;
			IF Prob<InitVal+eps and Prob>InitVal-eps then
			begin
				right=yval;
				yval=(yval+left)/2;
			end;
			delt=yval-left;
			count=0;
		end;
		If value1<>500 then
			value1=0;
		DZBuy=yval;
		Right=10000;
		Left=-10000;
		Prob=0;
	end;
	If BarNumber=CurrentBar and value1=500 then
		print("You have chosen too high accuracy for this system. Please try again.");

{end;

If (BlockNumber<>BNumb and BlockNumber<>BNumb1) then
	DZBuy=0;
}
and this is for indicator

Code:
Input: Ind((MACD(C,12,26))*10), N(70), StartPrB(0.12), StartPrS(0.12);
Vars: BuyZone(0), Indicator(0);

BuyZone = DZBuy(Ind, StartPrB, N);
Indicator = (Xaverage(MACD(C,12,26),9)*10);

{Please use the area below for all trade related adjustments
=================================================}

Plot1(Ind,"Indicator");
Plot2(BuyZone,"BuyZone");
Plot3(Indicator,"Slow");
in this code function code is very important and not easy to convert for me . i am beginner in amibroker but trading many years in tradestation .

after many hours work for this function code i convert this code to amibroker but . this is very very heavy for my ami and dont plot anything please help me i appreciate that . please convert this code correctly to amibroker. hep me guys

this is my try to converted . and not good . please help me and light and correct code convert thanks

Code:
function dyzonbuy(ml,InitVal,N)
{
Left=-10000; Right=10000;count=0;j=0;j1=0;Prob=0;eps=0.00001;yval=0;k=0;delt=0;
BNumb=355;BNumb1=308;value1=0;inh=0;
for (bar=1; bar< BarCount;bar++)
{value5=inh[bar];
BarNumber=bar;
if (BarNumber>N)
{
  for (k=0;k<N-1;k++)
  {
    return1[k]=return1[k+1];
  }
  return1[N-1]=value5;
}
else
{
j=BarNumber-1;
return1[j]=value5;
}
if (BarNumber>=N)
{
yval=(left+right)/2;
delt=yval-left;
while((delt>0.00005) AND (value1<50))
{
value1=value1+1;
for (j1=0; j1<N;j1++)
{
if (return1[j1]<yval)
{
count=count+1;
}
}
                        Prob=count/N;
               
                        if (Prob>InitVal+eps)
{
                                right=yval;
                                yval=(yval+left)/2;
                        }
                        if (Prob<InitVal-eps)
                        {
                                left=yval;
                                yval=(yval+right)/2;
                        }
                        if ((Prob<InitVal+eps) AND (Prob>InitVal-eps))
                        {
                                right=yval;
                                yval=(yval+left)/2;
                        }
                        delt=yval-left;
                        count=0;
                  }
                if (value1!=500 )
                {
                   value1=0;
    }
                DZBuy[bar]=yval;
                Right=100;
                Left=-100;
                Prob=0;
        }
}
DZb=DZBUY;
return DZb;
}
Plot(dyzonbuy(EMA(MACD(),9)*10,0.00012,70),"DZB",colorGreen, styleline);
Thanks for your help if you can.
 
Last edited:
#20
can anyone please convert this tradestation code to amibroker
This is a tradestatoion code for function DZBUY
Code:
[LegacyColorValue = true]; 

{User Function: DZBuy

Return:    The value of the Upper Bound such that Probability of a given indicator
	to be above this bound is equal to the given probability +- given accuracy.

Example. Indicator's values are 1, 2, 3, 4, 5, 6, 7, 8, 9, 9.  The Probability required is
	0.2 with an accuracy 0.05. Then the Upper bound for this indicator will be 8.  
	The Probability that the indicator is above 8 is equal 0.2 with the accuracy 
	0.05 because if it is 7 then the Probability is 0.30 and it is out of bounds.

Provided by: RINA Systems, Inc.

!!The only place to be changed here is the default value for the variable BNumb!!}


Input: Indictor(NUMERICSERIES), InitVal(NUMERIC), N(NUMERIC);

Vars: Left(-10000), Right(10000),count(0),j(0),j1(0),Prob(0),eps(0.001),yval(0),k(0),delt(0),
BNumb(35775),BNumb1(30208);
array: return[750](0);

{Right is the value of the indicator that serves as a high above which the probability is within
the bounds}

{If 1=1 {and (BlockNumber=BNumb or BlockNumber=BNumb1)} and  CurrentDate <20000306 then
begin}
	value5=Indictor;

	If BarNumber>N then
	begin
		For k=0 to N-2
		begin
			return[k]=return[k+1];
		end;
		return[N-1]=value5;
	end
	else
	begin
		j=BarNumber-1;
		return[j]=value5;
	end;
	If BarNumber>=N then
	begin 
		yval=(left+right)/2;
		delt=yval-left;
		while delt>0.005 and value1<50
	 	begin
			value1=value1+1;
			For j1=0 to N-1
			begin
				IF return[j1]<yval then
				begin
					count=count+1;
				end;
			end;
			Prob=count/N;
		
			IF Prob>InitVal+eps then
			begin
				right=yval;
				yval=(yval+left)/2;
			end;
			IF Prob<InitVal-eps then
			begin
				left=yval;
				yval=(yval+right)/2;
			end;
			IF Prob<InitVal+eps and Prob>InitVal-eps then
			begin
				right=yval;
				yval=(yval+left)/2;
			end;
			delt=yval-left;
			count=0;
		end;
		If value1<>500 then
			value1=0;
		DZBuy=yval;
		Right=10000;
		Left=-10000;
		Prob=0;
	end;
	If BarNumber=CurrentBar and value1=500 then
		print("You have chosen too high accuracy for this system. Please try again.");

{end;

If (BlockNumber<>BNumb and BlockNumber<>BNumb1) then
	DZBuy=0;
}
and this is for indicator

Code:
Input: Ind((MACD(C,12,26))*10), N(70), StartPrB(0.12), StartPrS(0.12);
Vars: BuyZone(0), Indicator(0);

BuyZone = DZBuy(Ind, StartPrB, N);
Indicator = (Xaverage(MACD(C,12,26),9)*10);

{Please use the area below for all trade related adjustments
=================================================}

Plot1(Ind,"Indicator");
Plot2(BuyZone,"BuyZone");
Plot3(Indicator,"Slow");
in this code function code is very important and not easy to convert for me . i am beginner in amibroker but trading many years in tradestation .

after many hours work for this function code i convert this code to amibroker but . this is very very heavy for my ami and dont plot anything please help me i appreciate that . please convert this code correctly to amibroker. hep me guys

this is my try to converted . and not good . please help me and light and correct code convert thanks

Code:
function dyzonbuy(ml,InitVal,N)
{
Left=-10000; Right=10000;count=0;j=0;j1=0;Prob=0;eps=0.00001;yval=0;k=0;delt=0;
BNumb=355;BNumb1=308;value1=0;inh=0;
for (bar=1; bar< BarCount;bar++)
{value5=inh[bar];
BarNumber=bar;
if (BarNumber>N)
{
  for (k=0;k<N-1;k++)
  {
    return1[k]=return1[k+1];
  }
  return1[N-1]=value5;
}
else
{
j=BarNumber-1;
return1[j]=value5;
}
if (BarNumber>=N)
{
yval=(left+right)/2;
delt=yval-left;
while((delt>0.00005) AND (value1<50))
{
value1=value1+1;
for (j1=0; j1<N;j1++)
{
if (return1[j1]<yval)
{
count=count+1;
}
}
                        Prob=count/N;
               
                        if (Prob>InitVal+eps)
{
                                right=yval;
                                yval=(yval+left)/2;
                        }
                        if (Prob<InitVal-eps)
                        {
                                left=yval;
                                yval=(yval+right)/2;
                        }
                        if ((Prob<InitVal+eps) AND (Prob>InitVal-eps))
                        {
                                right=yval;
                                yval=(yval+left)/2;
                        }
                        delt=yval-left;
                        count=0;
                  }
                if (value1!=500 )
                {
                   value1=0;
    }
                DZBuy[bar]=yval;
                Right=100;
                Left=-100;
                Prob=0;
        }
}
DZb=DZBUY;
return DZb;
}
Plot(dyzonbuy(EMA(MACD(),9)*10,0.00012,70),"DZB",colorGreen, styleline);
Thanks for your help if you can.
can anyone help me for correctthis thanks