Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------- Trend following -----------------------------------
- //-1. First - W (weekly chart): Screening for settled trend in the range of 2 to 5 weeks in the past, window 2W to 5W (by 4 vs 8EMA).
- //-2. Secondly - D (Daily chart) Screening for settled trend in the range of 8 to 11 days (10 vs 20EMA).
- //-Option: Screen 4H chart for a trigger where Pris(namely Close) crossing 5 til 20EMA (4H).
- //-Option: Study parameters for setting of the MACD as an alternative
- //-Option: This cross over can be tested by Back testing and live trading in a Paper trading account first.
- //-------------------------------------------------------------------------
- //
- TIMEFRAME(Weekly)
- //
- //-Downtrend:
- indicator1 = ExponentialAverage[4](close)
- indicator2 = ExponentialAverage[8](close)
- //-Sjekker at 13W EMA > 3W EMA dvs. ned-trend
- c0 = (indicator1[2] < indicator2[2])
- c1 = (indicator1[3] < indicator2[3])
- c2 = (indicator1[4] < indicator2[4])
- c3 = (indicator1[5] < indicator2[5])
- //c4 = (indicator1[6] > indicator2[6])
- //
- DnTrendW = ( c0 and c1 and c2 and c3) //and c4 )
- //
- //-Uptrend:
- indicator10 = ExponentialAverage[4](close)
- indicator11 = ExponentialAverage[8](close)
- //
- //
- c10 = (indicator10[2] > indicator11[2])
- c11 = (indicator10[3] > indicator11[3])
- c12 = (indicator10[4] > indicator11[4])
- c13 = (indicator10[5] > indicator11[5])
- //c14 = (indicator10[6] > indicator20[6])
- //
- UpTrendW = ( c10 and c11 and c12 and c13) //and c4 )
- //-----------
- TIMEFRAME(Daily)
- //
- //-Downtrend:
- indicator3 = ExponentialAverage[20](close)
- indicator4 = ExponentialAverage[10](close)
- //
- c5 = (indicator3[8] > indicator4[8])
- c6 = (indicator3[9] > indicator4[9])
- c7 = (indicator3[10] > indicator4[10])
- c8 = (indicator3[11] > indicator4[11])
- //c9= (indicator3[9] > indicator4[9])
- //c10= (indicator3[10] > indicator4[10])
- //
- DnTrendD = ( c5 and c6 and c7 and c8) //and c9 and c10 )
- //
- //-Uptrend:
- indicator13 = ExponentialAverage[20](close)
- indicator14 = ExponentialAverage[10](close)
- //
- c15 = (indicator13[8] < indicator14[8])
- c16 = (indicator13[9] < indicator14[9])
- c17 = (indicator13[10] < indicator14[10])
- c18 = (indicator13[11] < indicator14[11])
- //c19= (indicator13[9] < indicator14[9])
- //c10= (indicator13[10] < indicator14[10])
- //
- UpTrendD = ( c15 and c16 and c17 and c18) //and c9 and c10 )
- //
- //TIMEFRAME(4 Hour)
- //
- indicator15 = ExponentialAverage[20](close)
- VZinDnTrend = (close > indicator15)
- VZinUpTrend = (close < indicator15)
- //
- TIMEFRAME(DEFAULT)
- //
- //-DownTrend
- If DnTrendW then
- if DnTrendD then
- if VZinDnTrend then
- myTrend = -1
- else
- myTrend = 0
- endif
- endif
- Endif
- //
- //-UpTrend
- If UpTrendW then
- if UpTrendD then
- if VZinUpTrend then
- myTrend = 1
- else
- myTrend = 0
- endif
- endif
- Endif
- //-
- //-Summary
- //-
- If mytrend = 1 then
- Filter = 1
- Elsif myTrend = -1 then
- Filter = 1
- else
- Filter = 0
- endif
- SCREENER[Filter] (myTrend AS "Lng.1|Sht.-1")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement