{********************************************************************************* Formula di Trading System*** Filtro Butterworth*******************************************************************************}Var: par1, par2, par3;Var: op1, op2, op3, op4, op5, op6, op7, op8, op9, op10, op11;Var: filtro1, filtro2, buttblu, buttrossa;Var: oop1, oop2, oop3, oop4, oop5, oop6, oop7, oop8, oop9, oop10, oop11;Var: media1(0), media2(0), indzona1(0), Indzona2 (0);
// Valore parametripar1 = 14;par2 = 49;// calcolo 1 per parametro 1op1 = -PI;op2 = OP (op1, par1, Divis);op3 = EXP(op2);// calcolo 2 per parametro 1op4 = PI;op5 = OP (op4, par1, Divis);op6 = OP (1732, 1000, Divis);op7 = OP (op6, op5, Mul);op8 = COS(op7);op9 = OP (op3, op8, Mul);op10 = OP (2, op9, Mul);// calcolo 3 per parametro 1op11 = EXP (-2*op5);
// calcolo 1 per parametro 2oop1 = -PI;oop2 = OP (oop1, par2, Divis);oop3 = EXP(oop2);// calcolo 2 per parametro 2oop4 = PI;oop5 = OP (oop4, par2, Divis);oop6 = OP (1732, 1000, Divis);oop7 = OP (oop6, oop5, Mul);oop8 = COS(oop7);oop9 = OP (oop3, oop8, Mul);oop10 = OP (2, oop9, Mul);// calcolo 3 per parametro 2oop11 = EXP (-2*oop5);// calcolo parametro 3
par3 = SQRT (par1*par2);
filtro1 = (op10+op11)*filtro1[1]-(op11+(op10*op11))*filtro1[2]+(op11*op11)*filtro1[3]+((1-op10+op11)*(1-op11)/8)*(C+(3*C[1])+(3*C[2])+C[3]);
filtro2 = (oop10+oop11)*filtro2[1]-(oop11+(oop10*oop11))*filtro2[2]+(oop11*oop11)*filtro2[3]+((1-oop10+oop11)*(1-oop11)/8)*(C+(3*C[1])+(3*C[2])+C[3]);
buttblu = filtro1 - filtro2;
buttrossa = ((((buttblu-buttblu[1])*par3/(2*oop4)))+buttblu)/(1414/1000);
InstallStopLoss(INPERC, 2, "SL");
// impostare le condizioni di Long e Uscita
if PositionDir <> 1 thenif buttrossa > 0 then EnterLong(Bar, atClose); //ExitShort(Bar, atClose); Endif; Endif; if PositionDir <> -1 then if buttrossa < 0 then EnterShort(Bar, atClose); //ExitLong(Bar, atClose); Endif; Endif;
// Alla fine della Formula // Creo una zona, sotto al grafico, alta il 10% del grafico stesso.Indzona1 = CreateViewport(400, true, true);//Indzona2 = CreateViewport(200, true, true);
//PlotChart(buttblu, Indzona1, blue, solid, 2);PlotChart(buttrossa, Indzona1, red, solid, 2);//PlotChart(filtro2, Indzona1, blue, solid, 2);Var:quattroTPlow, quattroTPhigh;Var: Massimo, Minimo, contaMassimo, contaMinimo, minimoRel, massimoRel, zona2;
Var: DataPunto1,DataPunto2,DataPunto3,DataPunto4,Punto1(1),Punto2(0),Punt3(2),countPunto1(-1),countPunto2(-1),countPunto3(-1),ValPunto1,ValPunto2,ValPunto3,ValPunto4;
// Linea LowquattroTPlow = L < L[1] and L < L[2] and L < L[3] and L < L[4] and L < L[-1] and L < L[-2];
If quattroTPlow = true Then
ValPunto1=L;DataPunto1 = GetDate;if ValPunto1 > ValPunto2 ThenDrawLine (NEWOGG, 0, DataPunto2, ValPunto2,DataPunto1,ValPunto1 , green, 2, 0, EXTENDED);endif;colorbar(yellow);DrawCircle (createogg, 0, D, down, green, 0, 7);
endif;
quattroTPlow = L < L[1] and L < L[2] and L < L[3] and L < L[4] and L < L[-1] and L < L[-2];
If quattroTPlow = true Then
ValPunto2=L;DataPunto2 = GetDate;
endif;
// Linea HighquattroTPHigh = H > H[1] and H > H[2] and H > H[3] and H > H[4] and H > H[-1] and H > H[-2];
If quattroTPHigh = true Then
ValPunto3=H;DataPunto3 = GetDate;if ValPunto3 < ValPunto4 ThenDrawLine (NEWOGG, 0, DataPunto4, ValPunto4,DataPunto3,ValPunto3 , red, 2, 0, EXTENDED);endif;colorbar(blue);DrawCircle (createogg, 0, D, up, red, 0, 7);
endif;
quattroTPHigh = H > H[1] and H > H[2] and H > H[3] and H > H[4] and H > H[-1] and H > H[-2];
If quattroTPHigh = true Then
ValPunto4=H;DataPunto4 = GetDate;
endif;{********************************************************************************* Formula di Trading System*** Filtro Butterworth Aggressive*******************************************************************************}Var: par1, par2, par3;Var: op1, op2, op3, op4, op5, op6, op7, op8, op9, op10, op11;Var: filtro1, filtro2, buttblu, buttrossa;Var: oop1, oop2, oop3, oop4, oop5, oop6, oop7, oop8, oop9, oop10, oop11;Var: media1(0), media2(0), indzona1(0), Indzona2 (0);
// Valore parametripar1 = 22;par2 = 17;InstallStopLoss(INPERC,2.0,"SL");
// impostare le condizioni di Long e Uscita
if PositionDir <> 1 thenif buttrossa > buttrossa[1] and buttrossa[1] < buttrossa[2] then EnterLong(Bar, atClose); //EnterLong(NextBar, atOpen); Endif; Endif; if PositionDir <> -1 then if buttrossa < buttrossa[1] then ExitLong(Bar, atClose); //ExitLong(NextBar, atOpen); Endif; Endif;
// Alla fine della Formula // Creo una zona, sotto al grafico, alta il 10% del grafico stesso.Indzona1 = CreateViewport(400, true, true);Indzona2 = CreateViewport(200, true, true);
//PlotChart(buttblu, Indzona1, blue, solid, 2);
PlotChart(buttrossa, Indzona1, COLUPDOWNVAL, solid, 2);{********************************************************************************* Formula Demarker Indicator
*** Autore: Brucee*******************************************************************************}var: periodi,DeMax,DeMin,DMark,Indzona1;
periodi=13;If H > H[1] then DeMax = H- H[1];else DeMax = 0;endif;
If L < L[1] then DeMin = L[1] - L;else DeMin = 0;endif;
DMark = Mov(DeMax,periodi,S)/(Mov(DeMax,periodi,S)+Mov(DeMin,periodi,S));
Indzona1 = CreateViewport(400, true, true);PlotChart(DMark, Indzona1, blue, solid, 1);PlotChart(0.30, Indzona1, red, solid, 1);PlotChart(0.70, Indzona1, red, solid, 1);DMark = Mov(DeMax,periodi,S)/(Mov(DeMax,periodi,S)+Mov(DeMin,periodi,S));