MATY= Moving Average Typical Price Yesterday
I coded 10 parallel bands calculated from the moving average MATY. This is a useful indicator for tendency graphs, not for laterals. Set inc (increment, normally 10 for DAX) and p (number of periods, normally 20) as variables.
The way to use it is:
- Buy long in the moment that price crosses over MATY.
- Close trade if Price goes down two parallel bands (conservative) or 3 bands (aggressive)
- The same for sellshort, inverted.
The code is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// MATY Parallel Bands // // parameter //p = 20 //inc = 10 cc = close ty=(cc[1]+High[1]+Low[1])/3//Typical price yesterday MATY = average [p](ty)// Moving Average Typical price from Yesterday i=inc pp1=MATY+i pp2=MATY+2*i pp3=MATY+3*i pp4=MATY+4*i pp5=MATY+5*i pn1=MATY-i pn2=MATY-2*i pn3=MATY-3*i pn4=MATY-4*i pn5=MATY-5*i return MATY AS "MATY", pp1 AS "pp1", pp2 AS "pp2", pp3 AS "pp3", pp4 AS "pp4", pp5 AS "pp5", pn1 AS "pn1", pn2 AS "pn2", pn3 AS "pn3", pn4 AS "pn4", pn5 AS "pn5" |
It is also very helpful to use it together with the MATY PB Histogram. There can be seen the momento of the crossover (red-green) and when should you close the trade (histogram grey, conservative, and black aggressive). Set all the variables as histogram, with the exception of Máximo+ and Mínimo-. The code for this histo indicator is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
// MATY PARALLEL BANDS HISTOGRAMM// // parameter // p = 20 // inc = 10 (dax) cc = close ty=(cc[1]+High[1]+Low[1])/3//Typical price yesterday MATY = average [p](ty)// Moving Average Typical price from Yesterday i=inc pp1=MATY+i pp2=MATY+2*i pp3=MATY+3*i pp4=MATY+4*i pp5=MATY+5*i pn1=MATY-i pn2=MATY-2*i pn3=MATY-3*i pn4=MATY-4*i pn5=MATY-5*i IF cc>pp5 THEN stat=6 ELSIF cc>pp4 THEN stat=5 ELSIF cc>pp3 THEN stat=4 ELSIF cc>pp2 THEN stat=3 ELSIF cc>pp1 THEN stat=2 ELSIF cc>MATY THEN stat=1 ELSIF cc<pn5 THEN stat=-6 ELSIF cc<pn4 THEN stat=-5 ELSIF cc<pn3 THEN stat=-4 ELSIF cc<pn2 THEN stat=-3 ELSIF cc<pn1 THEN stat=-2 ELSIF cc<MATY THEN stat=-1 ENDIF //*********************** REM cuenta velas seguidas del mismo color verde colorigual1=(stat>0) contador1=0 WHILE colorigual1[contador1] DO contador1=contador1+1 WEND //*********************** REM cuenta velas seguidas del mismo color rojo colorigual2=(stat<0) contador2=0 WHILE colorigual2[contador2] DO contador2=contador2+1 WEND //*********************** IF stat>0 THEN sig1=highest [contador1](stat) ELSE sig1=0 ENDIF IF stat<0 THEN sig2=lowest [contador2](stat) ELSE sig2=0 ENDIF IF stat<0 AND sig2-stat<=-2 THEN senc=1 ELSE senc=0 ENDIF IF stat>0 AND sig1-stat>=2 THEN senl=-1 ELSE senl=0 ENDIF IF stat<0 AND sig2-stat<=-3 THEN sencc=1 ELSE sencc=0 ENDIF IF stat>0 AND sig1-stat>=3 THEN senll=-1 ELSE senll=0 ENDIF RETURN stat AS "Status", sig1 AS "Máximo +", sig2 AS "Mínimo -", senc AS "Señal 2 paralelas cortos", senl AS "Señal 2 paralelas largos", senll AS "Señal 3 paralelas largos", sencc AS "Señal 3 paralelas cortos" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials