Programmazione Amibroker Regolo su Amiborker

  • Creatore Discussione Creatore Discussione reef
  • Data di Inizio Data di Inizio
beh, a me interesserebbe...


Ok, lo allego
la modifica è quella in rosso


Codice:
/* TX CON SEGNALI DA FTSE */ 






SetPositionSize(1,spsShares);





VOL=100*abs (C/Ref (C,-1))-100;VOL1=100*abs (Ref (C,-1) /Ref (C,-2))-100;VOL2=100*abs (Ref (C,-2) /Ref (C,-3))-100;VOL3=100*abs (Ref (C,-3) /Ref (C,-4))-100;VOL4=100*abs (Ref (C,-4) /Ref (C,-5))-100;VOL5=100*abs (Ref (C,-5) /Ref (C,-6))-100;VOL6=100*abs (Ref (C,-6) /Ref (C,-7))-100;VOL7=100*abs (Ref (C,-7) /Ref (C,-8))-100;VOL8=100*abs (Ref (C,-8) /Ref (C,-9))-100;VOL9=100*abs (Ref (C,-9) /Ref (C,-10))-100;VOL10=100*abs (Ref (C,-10) /Ref (C,-11))-100;VOL11=100*abs (Ref (C,-11) /Ref (C,-12))-100;VOL12=100*abs (Ref (C,-12) /Ref (C,-13))-100;VOL13=100*abs (Ref (C,-13) /Ref (C,-14))-100;VOL14=100*abs (Ref (C,-14) /Ref (C,-15))-100;



XVOL =abs (VOL)+abs (VOL1)+abs (VOL2)+abs (VOL3)+abs (VOL4)+abs (VOL5)+abs (VOL6)+abs (VOL7)+abs (VOL8)+abs (VOL9)+abs (VOL10)+abs (VOL11)+abs (VOL12)+abs (VOL13)+abs (VOL14);


/* KELTERN */

VOLA=XVOL/15;

VOLARE=HHV(VOLA,3);

st=1;
ss=0.8;
MC=MA(C,11);
ELMH=MC*(1+(1*(VOLARE^0.5)/100));ELML=MC*(1-(1*(VOLARE^0.5)/100));

mc2=MA(C,13);
VOLARE=HHV(VOLA,3);
ELMH2=MC2*(1+(0.8*(VOLARE^0.4)/100));ELML2=MC2*(1-(0.8*(VOLARE^0.4)/100));

/*FINE KELTERN */





tVOL=100*abs (C/Ref (C,-2))-100;tVOL1=100*abs (Ref (C,-1) /Ref (C,-3))-100;tVOL2=100*abs (Ref (C,-2) /Ref (C,-4))-100;tVOL3=100*abs (Ref (C,-3) /Ref (C,-5))-100;tVOL4=100*abs (Ref (C,-4) /Ref (C,-6))-100;tVOL5=100*abs (Ref (C,-5) /Ref (C,-7))-100;tVOL6=100*abs (Ref (C,-6) /Ref (C,-8))-100;tVOL7=100*abs (Ref (C,-7) /Ref (C,-9))-100;tVOL8=100*abs (Ref (C,-8) /Ref (C,-10))-100;tVOL9=100*abs (Ref (C,-9) /Ref (C,-11))-100;tVOL10=100*abs (Ref (C,-10) /Ref (C,-12))-100;tVOL11=100*abs (Ref (C,-11) /Ref (C,-13))-100;tVOL12=100*abs (Ref (C,-12) /Ref (C,-14))-100;tVOL13=100*abs (Ref (C,-13) /Ref (C,-15))-100;tVOL14=100*abs (Ref (C,-14) /Ref (C,-16))-100;tVOL15=100*abs (Ref(C,-15)/Ref (C,-17))-100;tVOL16=100*abs (Ref (C,-16) /Ref (C,-18))-100;tVOL17=100*abs (Ref (C,-17) /Ref (C,-19))-100;tVOL18=100*abs (Ref (C,-18) /Ref (C,-20))-100;tVOL19=100*abs (Ref (C,-19) /Ref (C,-21))-100;tVOL20=100*abs (Ref (C,-20) /Ref (C,-22))-100;tVOL21=100*abs (Ref (C,-21) /Ref (C,-23))-100;tVOL22=100*abs (Ref (C,-22) /Ref (C,-24))-100;tVOL23=100*abs (Ref (C,-23) /Ref (C,-25))-100;tVOL24=100*abs (Ref (C,-24) /Ref (C,-26))-100;tVOL25=100*abs (Ref (C,-25) /Ref (C,-27))-100;tVOL26=100*abs (Ref (C,-26) /Ref (C,-28))-100;tVOL27=100*abs (Ref (C,-27) /Ref (C,-29))-100;tVOL28=100*abs (Ref (C,-28) /Ref (C,-30))-100;tVOL29=100*abs (Ref (C,-29) /Ref (C,-31))-100;tVOL30=100*abs (Ref (C,-30) /Ref (C,-32))-100;tVOL31=100*abs (Ref (C,-31) /Ref (C,-33))-100;tVOL32=100*abs (Ref (C,-32) /Ref (C,-34))-100;tVOL33=100*abs (Ref (C,-33) /Ref (C,-35))-100;tVOL34=100*abs (Ref (C,-34) /Ref (C,-36))-100;tVOL35=100*abs (Ref (C,-35) /Ref (C,-37))-100;tVOL36=100*abs (Ref (C,-36) /Ref (C,-38))-100;tVOL37=100*abs (Ref (C,-37) /Ref (C,-39))-100;tVOL38=100*abs (Ref (C,-38) /Ref (C,-40))-100;tVOL39=100*abs (Ref (C,-39) /Ref (C,-41))-100;


                                                                                                                                                                                                                                                                                                                                                    

tXVOL =abs (tVOL)+abs (tVOL1)+abs (tVOL2)+abs (tVOL3)+abs (tVOL4)+abs (tVOL5)+abs (tVOL6)+abs (tVOL7)+abs (tVOL8)+abs (tVOL9)+abs (tVOL10)+abs (tVOL11)+abs (tVOL12)+abs (tVOL13)+abs (tVOL14)+abs (tVOL15)+abs (tVOL16)+abs (tVOL17)+abs (tVOL18)+abs (tVOL19)+abs (tVOL20)+abs (tVOL21)+abs (tVOL22)+abs (tVOL23)+abs (tVOL24)+abs (tVOL25)+abs (tVOL26)+abs (tVOL27)+abs (tVOL28)+abs (tVOL29)+abs (tVOL30)+abs (tVOL31)+abs (tVOL32)+abs (tVOL33)+abs (tVOL34)+abs (tVOL35)+abs (tVOL36)+abs (tVOL37)+abs (tVOL38)+abs (tVOL39);


/*VOLA BO tx */

bVOL =abs (VOL)+abs (VOL1)+abs (VOL2)+abs (VOL3)+abs (VOL4)+abs (VOL5) +abs(VOL6);
BVOLA=BVOL/7;
VOLABOL=HHV(BVOLA,2);

mbo=MA(C,8);
kbo=mbo*(1+(1.60*(VOLABOL^0.7))/100);
Lbo=mbo*(1-(1.6*(VOLABOL^0.7))/100);

/* FINE VOLA BO*/

/*ID BO*/
MIDBO=MA(C,10);
HIDBO=MIDBO*(1+(2.70*(VOLARE^1.4))/100);
LIDBO=MIDBO*(1-(3.60*(VOLARE^1.1))/100);
ID=MA(C,34);

OPERABO=IIf ((ID>HIDBO)OR(ID<LIDBO),0,1);

/*FINE ID BO*/




/* vola AE */

txVOLA=tXVOL/40;

txVOLARE=HHV(txVOLA,8);




MEDIABREK=MA(C,20);
ELMH=MC*(1+(1*(VOLARE^0.5)/100));ELML=MC*(1-(1*(VOLARE^0.5)/100));

mc2=MA(C,13);
VOLARE=HHV(VOLA,3);
ELMH2=MC2*(1+(0.8*(VOLARE^0.4)/100));ELML2=MC2*(1-(0.8*(VOLARE^0.4)/100));

/*FINE vola */

/*CANALE SMOO */

SMOK=Ref(C,-40);
SMOKI=Ref(C,-40);
for( i = 1; i <=40; i++ )

{

smok=(2/12)*(Ref(C,-(40-i))-smok)+smok;
smokI=(2/13)*(Ref(C,-(40-i))-smokI)+smokI;


}



/* FINE CANALE SMOO */

MEDIABREAK1=MA(C,20);
MEDIABREAK2=MA(C,24);


AEMLOW1=smokI*(1-(0.95*(TXVOLARE^1.30)/100));
AEMHIGH1=smokI*(1+(0.95*(TXVOLARE^1.30)/100));

AEMLOW2=smok*(1-(1.10*(TXVOLARE^0.75)/100));
AEMHIGH2=smok*(1+(1.10*(TXVOLARE^0.75)/100));


/*ADX PRINCIPALE */
PDMI=IIf (C>Ref(C,-1),C-Ref(C,-1),0);
MDMI=IIf (C<Ref(C,-1),Ref(C,-1)-C,0);

Q=0;    
w=0;
for( i = 1; i <=99; i++ )


{
Q=Q-Q/6+Ref(PDMI,-(100-i));
W=W-W/6+Ref(MDMI,-(100-i));

}
                                        

KPDMI=Q-Q/6+PDMI;

KMDMI=W-W/6+MDMI;

dxI=100*abs(KPDMI-KMDMI)/(KPDMI+KMDMI);

Zn1=0;

for( i = 1; i <=100; i++ )


{
zn1 =Zn1*7/8+Ref(DXI,-(100-i))/8;

}


/*FINE ADX PRINCIPALE */

/* adx tx e adxbo*/


PDMI=IIf (C>Ref(C,-1),C-Ref(C,-1),0);
MDMI=IIf (C<Ref(C,-1),Ref(C,-1)-C,0);


Q=0;    
w=0;
for( i = 1; i <=99; i++ )


{
Q=Q-Q/7+Ref(PDMI,-(100-i));
W=W-W/7+Ref(MDMI,-(100-i));

}

                                                
KPDMI=Q-Q/7+PDMI;

KMDMI=W-W/7+MDMI;

dxI=100*abs(KPDMI-KMDMI)/(KPDMI+KMDMI);


Zn=0;


for( i = 1; i <=100; i++ )

 
{
zn =Zn*4/5+Ref(DXI,-(100-i))/5;

}

/*FINE ADX tx e adxbo */
fr=10;fb=16;fc=16;fq=23;

/*fr=Optimize("macd",11,9,15,1);
fb=Optimize("macdx",16,10,20,1);
fc=Optimize("macd4",13,10,20,1);
fq=Optimize("macd4x",23,18,28,1);*/
MACD3=MACD(fr,fb)-Signal(fr,fb,11);
MACD4=MACD(fc,fq)-Signal(fc,fq,11);

 

s1=Cross(MACD4,0);

 s2=Cross(C,ELMH);

S3 = Cross (ZN,22);

 s4=Cross(0,MACD4);

 s5=Cross(ELML,C);

S6=Cross(22,ZN);

S7=Cross(MACD3,0);
S8=Cross(ELML2,C);
S9=Cross(0,MACD3);
S10=Cross(C,ELMh2);


S11=Cross(AEMLOW1,MEDIABREAK1);
S12=Cross(MEDIABREAK2,AEMHIGH2);

S13=Cross(C,LBO);
S14=Cross(KBO,C);

s15=Cross(C,lbo);
s16=Cross(kbo,C);

s20=Cross(Volare, 2.50);
s21=Cross(2.50,Volare);

[COLOR=Red]/*regoloE*/

LongEL=Flip(S1,S4) AND Flip(S2,S5)  ;
Shortel=Flip(s4,s1) AND Flip ( s5,s2);
LongEs=Flip(s7,s9) AND Flip (s10,s8);
ShortES=Flip(s9,S7)AND Flip(s8,s10) ;


Buy100=Flip(S1,S4) AND Flip(S2,S5)  ;
Short100=Flip(s9,S7)AND Flip(s8,s10) ;

BuyEL=Flip(Longel,Shortel);
SELLES=Flip(ShortES,LongeS);
TIMEEL=BarsSince(BuyEL);
timees=BarsSince(Selles);


Buye=Flip(longel,shortes) AND Ref(TIMEEL,-1)>0 OR Flip(Longel,Shortes) AND Ref(TIMEEL,-1)==0 AND Flip(Longes,Shortes);
Shorte=Flip(Shortes,Longel)AND Ref(timees,-1)>0 OR Flip (Shortes,Longel) AND Ref(timees,-1)==0 AND Flip (Shortel,Longel);
/*fine regoloe*/
[/COLOR]

Buy1=Flip(Buye,Shorte);
Short1=Flip(Shorte,Buye);

Cond1=BarsSince(Flip(Buy1,Short1));
Cond2=BarsSince(Flip(Short1,Buy1));

Buy1=BUYE AND  ZN1>22 AND cond2==1;
Short1=ShortE AND ZN1>22 AND Cond1==1;
Sell1=ZN1<22;

Condizione1=BarsSince(Flip(Buy1,Short1 OR Sell1));
Condizione2=BarsSince(Flip(Short1,Buy1 OR Sell1));




Buy100=BuyE ;
Short100=ShortE;

ybuy=BarsSince(Buy100);
yshort=BarsSince(Short100);
yflat=BarsSince(zn<22);

TXBUY=IIf(Flip(s1,s4) AND Flip(S2,S5) AND ZN1>22 AND Flip(S11,S12) AND YBUY<=YFLAT,1,0);
TXSHORT=IIf(Flip(S9,S7) AND Flip(S8,S10) AND ZN1>22 AND Flip(S12,S11) AND YSHORT<=YFLAT,1,0);
Buyxbo=Flip(Buy100,Short100) AND yflat>0;
Shortxbo=Flip(Short100,Buy100) AND yflat>0;


Buybof1=Flip(Buyxbo,Shortxbo);
Shortbof1=Flip(Shortxbo,Buyxbo);

Buy6=C>LBO AND Ref(C,-1)<Ref(LBO,-1) AND OPERABO==1 ;
Short6=C<KBO AND Ref(C,-1)>Ref(KBO,-1) AND OPERABO==1 ;
COND6=BarsSince(Flip(Buy6,Short6 ));
COND7=BarsSince(Flip(Short6,Buy6 ));
Buy8=C>LBO;
Short8=C<KBO;


Buy9=Flip(Buy8,Short8) ;

Short9=Flip(Short8,Buy8);

xbuy=BarsSince(Short6);
xshort=BarsSince(Buy6);
xflat=BarsSince(Operabo==0);

Buytbo= Operabo==1 AND Buy6;
Selltbo=Operabo==0;

Shorttbo=Operabo==1  AND Short6;

Buykk=BarsSince(Flip(Buytbo,Selltbo OR Shorttbo));
Shortkk=BarsSince(Flip(Shorttbo,Buytbo OR Selltbo));
Sellkk=BarsSince(Flip(Selltbo,Shorttbo OR Buytbo));
Buybof2=Shortkk>0 AND Sellkk>0 ;
Shortbof2=Buykk>0 AND Sellkk>0;
Sellbof=Sellkk==0;

Buytx2=Buybof1 AND Buybof2;
Shorttx2=Shortbof1 AND Shortbof2;
Selltx2=Sellbof OR Buybof1 AND Shortbof1 OR Buybof1 AND Shortbof2 OR Buybof2 AND Shortbof1 OR Buybof2 AND Shortbof2;




tx1=CONDIZIONE2>0 AND Flip (S11,S12) AND zn1>22 ;
tx2=zn1<22 OR CONDIZIONE2>0 AND Flip(S12,S11);
 
tx3=CONDIZIONE1>0 AND Flip(S12,S11) AND zn1>22;
tx4= zn1<22 OR CONDIZIONE1>0 AND Flip(S11,S12);

tx9=IIf(zn1<22 OR CONDIZIONE2>0 AND Flip(S12,S11),1,0);
tx10=IIf(tx4= zn1<22 OR CONDIZIONE1>0 AND Flip(S11,S12),1,0);

/*nuovo filtro vola*/
Buytx=tx1 AND tx10==0;
Shorttx=tx3 AND tx9==0;
Selltx=tx2 OR tx4;

TXBuy=Buytx OR Selltx AND Buytx2;
TXShort=Shorttx OR Selltx AND Shorttx2;
TXSell=Selltx2;


ponte=BuyTX OR SellTX AND BuyTX2;
ponti=TXSHORT OR SellTX AND ShortTX2;
fritz =BarsSince(ponte);
fritz2=BarsSince(ponti);
pb=Optimize("vola",2.50,1.5,3,0.02);

/*fine filtro vola*/
Buy=BuyTX AND volare <pb AND Ref(fritz,-1) > 0  OR SellTX AND BuyTX2 AND Volare<pb AND Ref(fritz,-1) > 0;
Short=TXSHORT AND volare <pb AND Ref(fritz2,-1)>0 OR SellTX AND ShortTX2 AND Volare <pb AND Ref(fritz2, -1)>0;
Sell=SellTX AND SellTX2;
Cover=Sell;



Buy=ExRem(Buy,Sell OR Short OR Cover);
Short=ExRem(Short,Buy OR Sell OR Cover);
Sell=ExRem(Sell,Buy OR Short);
Cover=ExRem(Cover,Buy OR Short);



Condcolor=Buy ;
Condcolor1=Sell;
Condcolor2=Short;

BarColor=IIf(Condcolor,5,IIf(Condcolor1,7,IIf(Condcolor2,4,1)));




Plot(C,"Close",BarColor,styleCandle);




"VOLA E (COL.F)              ="+WriteVal(VOLARE,forMAT=1.2);
"KELTERN MEDIA CANALE (COL.G)="+WriteVal(MC,forMAT=1.0);
"KELTREN ELMH (COL.H)        ="+WriteVal(ELMH,forMAT=1.0);
"KELTERN ELML (COL.I)        ="+WriteVal(ELML,forMAT=1.0);
"MACD 13,23,11 (COL.N)       ="+WriteVal(MACD4,forMAT=1.0);
"KELTERN MEDIA CANALE (COL.R)="+WriteVal(MC2,forMAT=1.0);
"KELTREN ELMH (COL.S)        ="+WriteVal(ELMH2,forMAT=1.0);
"KELTERN ELML (COL.T)        ="+WriteVal(ELML2,forMAT=1.0);
"MACD 11,16,11 (COL.Y)       ="+WriteVal(MACD3,forMAT=1.0);
"ADX EA 6,8,22 (COL.AS/CV) ="+WriteVal(ZN1,forMAT=1.2);
"VOLA EA (COL.AX) ="+WriteVal(TXVOLARE,forMAT=1.2);
"SMOOCANALE (COL.AY/BD) ="+WriteVal(SMOk,forMAT=1.2);
"SMOOCANALE1 (COL.AY/BD) ="+WriteVal(SMOkI,forMAT=1.2);

"SMOO ELML (COL.AZ) ="+WriteVal(AEMLOW1,forMAT=1.2);
"SMOO ELMH (COL.BA) ="+WriteVal(AEMHIGH1,forMAT=1.2);
"MEDIABREAK (COL.BB) ="+WriteVal(MEDIABREAK1,forMAT=1.2);
"SMOO ELML (COL.BE) ="+WriteVal(AEMLOW2,forMAT=1.2);
"SMOO ELMH (COL.BF) ="+WriteVal(AEMHIGH2,forMAT=1.2);
"MEDIABREAK (COL.BG) ="+WriteVal(MEDIABREAK2,forMAT=1.2);
"ID MEDIA CANALE (COL.BN/BO)="+WriteVal(MIDBO,forMAT=1.0);
"ID ELMH (COL.BP)="+WriteVal(HIDBO,forMAT=1.0);
"ID ELML (COL.BQ)="+WriteVal(LIDBO,forMAT=1.0);
"ID (COL.BR)="+WriteVal(ID,forMAT=1.0);

 
"VOLA BO(COL.BV) ="+WriteVal(Volabol,forMAT=1.2);
"TBO & KBO MEDIA CANALE (COL.BW/CZ) ="+WriteVal(MBO,forMAT=1.0);
"TBO  & KBO ELMH (COL.BX/DA) ="+WriteVal(KBO,forMAT=1.0);
"TBO & KBO ELML (COL.BY/DB) ="+WriteVal(LBO,forMAT=1.0);
"ADX BO (COL.CG) ="+WriteVal(ZN,forMAT=1.2);



DIF=(C*100/Ref(C,-1))-100;

WK=BarsSince(Buy);
WH=BarsSince(Short);
KW=IIf(Flip(Buy,Short),Ref(C,-WK),Ref(C,-WH)) ;
GN=IIf(Flip(Buy,Short),C-KW,KW-C);
Title = Name()
        + " CLOSE = " + WriteVal(C, 1.2)+"  " +WriteVal(DIF, 1.2)+EncodeColor (colorYellow)+" ** (CORRETTO) NUOVO TX CON FILTRO VOLA = 2,50; SEGNALI DA FTSE MIB**  "+EncodeColor(colorBlack)+Date()
+"\n"+EncodeColor (colorBlue)+ " POSIZIONE APERTA A = "+WriteVal(kw,1.0)+"\n" + " GAIN POSIZIONE (Punti) =    "+WriteVal(GN,1.0);  


PlotShapes(shapeUpArrow*(Buy), colorBrightGreen ); 
PlotShapes(shapeHollowDownArrow*(Sell), colorYellow ); 
PlotShapes(shapeHollowUpArrow*(Sell), colorYellow ); 


PlotShapes(shapeDownArrow*(Short), colorRed ); 
PlotOHLC( 1*Open, 1* High, 1* Low, 1* Close, "CLOSE", colorBlack, styleCandle );
Plot( Flip( s20, S21 ), "filtro vola", colorOrange, styleArea | styleOwnScale, 0,1 );
 
Ok, lo allego
la modifica è quella in rosso

grazie mille, ho visto che ci sono vari parametri di cui è possibile fare l'ottimizzazione. Qualcuno ha provato a farla per estenderne l'uso ad altri strumenti o in altri timeframe?

Ho letto che Regolo è stato progettato ad hoc per il nostro indice, nonostante questo mi chiedevo se qualcuno ha provato e ha trovato risultati negativi

Non ho ancora provato a fare questo test perchè ho avuto un problemino con AB
 
Ho letto che Regolo è stato progettato ad hoc per il nostro indice, nonostante questo mi chiedevo se qualcuno ha provato e ha trovato risultati negativi

Evita assolutamente trasposizioni su altri mercati o TF così come la riottimizzazione dei parametri

ciao
 

Users who are viewing this thread

Back
Alto