SuperBandPass Filter strategy - DAX H4

Category: Strategies By: ebous64 Created: November 14, 2022, 3:46 PM
November 14, 2022, 3:46 PM
Strategies
6 Comments

Algorithm built by @ebous64 around the base indicator established by PRC SuperBandPass

In Incubation since December 2021. Not tested in real life.

Long on filter crossing above its -RMS line

Short on filter crossing below its RMS line

Long position output when filter passes below RMS, or below -RMS, false input signal

Short position output when filter passes above -RMS or above RMS (meaning false input signal)

Less logical additions possible: Short only (or complementary) at -RMS (long) and RMS (short) line crossings

//                                                ****************************
//                                                *  BANDE PASSANTE - DAX H4 *
//                                                ****************************




//Algorithme construit par @ebous64 autour de l'indicateur de base établi par PRC SuperBandPass
//En Incubation depuis décembre 2021. Pas testé en réel.
//Long sur le filtre traversant au dessus de sa ligne -RMS
//Short sur le filtre traversant en dessous de sa ligne RMS
//Sortie de position longue lorsque le filtre passe en dessous de RMS, ou en dessous de -RMS, faux signal d'entrée
//Sortie de position courte lorsque le filtre passe au-dessus de -RMS ou au-dessus de RMS (ce qui signifie un faux signal d'entrée)
//Ajouts moins logiques possibles: Court-circuits seulement (ou complémentaires) aux passages traversants des lignes -RMS (long) et RMS (short)

//*************** Définition des paramètres du code************************
DEFPARAM CumulateOrders = False          // Cumul des positions désactivé
DEFPARAM Preloadbars = 1000
//*********** Déclaration des variables - Initialisation - Définition des stoploss et sécuristaion des gains **********
ONCE STOPTARGET = stptg                 // Stop Target initial à +220 ; optimisable à 215 ?
ONCE pointSupplementaires = ptsup       //initial 10  ; optimisable à 5 ? Attention 5 distance minimale à respecter avec le broker
ONCE debutSecurisationPoints = STOPTARGET + pointSupplementaires             //Variable debutSecurisationPoints initialisée !

flen = flen                             //initial 35:fast length; peut-être travaillé
slen = slen                             //initial 65 slow length; peut-être travaillé
IF barindex>slen then
a1= 5/flen             //initial 35; division avec flen
a2= 5/slen             //initial 65; division avec slen
PB = (a1 - a2) * close + (a2*(1 - a1) - a1 * (1 - a2))* close[1] + ((1 - a1) + (1 - a2))*(PB[1])- (1 - a1)* (1 - a2)*(PB[2])
RMSa = summation[50](PB*PB)
RMSplus = sqrt(RMSa/50)
RMSminus = -RMSplus
//********************* Réinitialisation / à une nouvelle journée *********************
IF intradaybarindex = 0 THEN
conditionACHAT = 0
conditionVENTE = 0
valeurindicateur = undefined
ENDIF
ENDIF
// ************************ Horaires de trading ***************************************
TradeTime = time>000000 and time<220000
NoTradeTime = time>=220000 and time<000000
// ************ Code pour limiter le nombre d'ouvertures par jour *********************
ONCE nombreTrades = 2                       // nombres maximum de trades dans la journée :
IF intradaybarindex = 0 THEN
takenCall = 0
takenPut = 0
conditionNbTradeByDay = 1
ENDIF

IF takenCall + takenPut < nombreTrades THEN
conditionNbTradeByDay = 1
ELSE
conditionNbtradeByDay = 0
ENDIF
//********************* VOLATILITY DETECTION **************************************
volatilitySmallMin = vsmin                 //initial 25
volatilitySmallMax = vsmax                 //initial 110
//volatilityMidMin = vmmin                 //15
//volatilityMidMax = vmmax                 //140
volatilitySmall = STD[5] (close)
//volatilityMid = STD[10] (close)
conditionVolatilitySmall = volatilitySmall > volatilitySmallMin AND volatilitySmall < volatilitySmallMax
//conditionVolatilityMid = volatilityMid > volatilityMidMin AND volatilityMid < volatilityMidMax
conditionVolatility = conditionVolatilitySmall //AND conditionVolatilityMid
// ****** Conditions pour ouvrir une position acheteuse ********
c1 = PB CROSSES OVER RMSminus
c2 = PB >= pby                            //initial -55
//c02 = RMSA >= pbz                       //23
//************************ Conditions pour ouvrir une position d'achat *******************************
IF NOT LongOnMarket AND TradeTime AND conditionNbTradeByDay AND conditionVolatility THEN
IF c1 AND c2 AND sqrt(summation[50](PB*PB)/50)< nbx THEN
BUY 1 CONTRACT AT MARKET
takenCall = takenCall + 1
//Mise à zéro des variables
prixachat = 0
prixSTOPVente = 0
profitPoint = 0
ENDIF
ENDIF
//***************** Conditions pour fermer une position acheteuse ****************
// options toutes présentées car le code ici n'est pas intuitif. Utilisations, ajouts possibles des variables type "c0."
c3 = PB CROSSES OVER RMSplus         // préféré à under...les résultats...mais moins intuitif... SURPRISE !!!
//c03 = PB CROSSES UNDER RMSplus     // Utilisation dans l'alternative, ajout, optionnels. A développer
c4 = PB CROSSES OVER RMSminus        // préféré à UNDER plus logique mais moins efficace
//c04 = PB CROSSES UNDER RMSminus    // Utilisation dans l'alternative, ajout, optionnels. A développer
IF LongOnMarket THEN
IF c3 OR c4 THEN                  //or c03 or c04
SELL AT MARKET
ENDIF
//Sécurisation des gains
prixachat = POSITIONPRICE
profitPoint = close - prixachat
conditionProfitPoint = (profitPoint >= debutSecurisationPoints)
IF conditionProfitPoint THEN
closeMoinsX = close -1
prixSTOPVente = MAX(prixSTOPVente, closeMoinsX)
SELL AT prixSTOPVente STOP
ENDIF
ENDIF
//**************** Conditions pour ouvrir une position en vente à découvert *************
c5 = PB CROSSES UNDER RMSplus
c6 = PB <= pbx                        // 56
IF NOT ShortOnMarket AND TradeTime AND conditionNbTradeByDay AND conditionVolatility THEN
IF c5 AND c6 AND sqrt(summation[50](PB*PB)/50)> nby THEN
SELLSHORT 1 CONTRACT AT MARKET
takenPut = takenPut + 1
//Mise à zéro des variables
prixvente = 0
prixSTOPAchat = 0
profitPoint = 0
ENDIF
ENDIF
//************ Conditions pour fermer une position en vente à découvert ******************
c7 = PB CROSSES under RMSminus
//c07 = PB CROSSES over RMSminus          //Utilisation dans l'alternative, ajout, optionnels. A développer
c8 = PB CROSSES OVER RMSplus
//c08= PB CROSSES UNDER RMSplus          //Utilisation dans l'alternative, ajout, optionnels. A développer
IF ShortOnMarket THEN
IF c7 OR c8 THEN                      //or c07 or c08
EXITSHORT AT MARKET
ENDIF
//Sécurisation des gains
prixvente = POSITIONPRICE
profitPoint = prixvente - close
conditionProfitPoint = (profitPoint >= debutSecurisationPoints)
IF conditionProfitPoint THEN
closePlusX = close + 1
prixSTOPAchat = MAX (prixSTOPAchat, closePlusX)
BUY AT prixSTOPAchat STOP
ENDIF
ENDIF
//************* Stops et objectifs *****************
SET STOP %Loss stplos                     // 1.25
SET Target %profit tp                     // 2.8 Target "haut". Détailler les opérations...pour un choix autre

GRAPH PB
GRAPH RMSplus coloured(0,0,255)
GRAPH RMSminus coloured(255,0,0)

Download
Filename: Bande-Passante-V03.2.itf
Downloads: 470
ebous64 Junior

Comments

Logo Logo
Loading...