Hi, I would like to make a screener to show a when a certain MACD histogram appears first time above ( for a buy) or below (for sell ) the zero line and to scan and display this potential setup on multiple time frames all in one scan like 15m, 30 min, 60min, 4 hr, D, W.
Is this easy to do?
I will attach a chart for clearer explanation
Thanks
That condition happening exactly at the same time on all these timeframes will not occur very often! Maybe never?
By the way, it should be easy to test with a code made with the assisted creation, did you try it?
Hi, I was looking for the signal to show in the screeener on any of the potential timeframes mentioned individually, and then display any and all timeframe signals in one screener window if possible?
I also tried to get a 1st histogram ( as per screenshot) either above or below the zero line using the ‘assisted creation’ but I could not get it to work correctly. Any advice?
Hi, can anyone help with this?
Timeframe(Weekly)
AboveW = Macd[12,26,9](close) CROSSES OVER 0
UnderW = Macd[12,26,9](close) CROSSES UNDER 0
//
Timeframe(Daily)
AboveD = Macd[12,26,9](close) CROSSES OVER 0
UnderD = Macd[12,26,9](close) CROSSES UNDER 0
//
Timeframe(4 hour)
Above4 = Macd[12,26,9](close) CROSSES OVER 0
Under4 = Macd[12,26,9](close) CROSSES UNDER 0
//
Timeframe(1 hour)
Above1 = Macd[12,26,9](close) CROSSES OVER 0
Under1 = Macd[12,26,9](close) CROSSES UNDER 0
//
Timeframe(30 minutes)
Above30 = Macd[12,26,9](close) CROSSES OVER 0
Under30 = Macd[12,26,9](close) CROSSES UNDER 0
//
Timeframe(15 minutes)
Above15 = Macd[12,26,9](close) CROSSES OVER 0
Under15 = Macd[12,26,9](close) CROSSES UNDER 0
//
Timeframe(default)
CondW = 9000000
If AboveW Then
CondW = 1000000
Elsif UnderW Then
CondW = 2000000
Endif
CondD = 900000
If AboveD Then
CondD = 100000
Elsif UnderD Then
CondD = 200000
Endif
Cond4 = 90000
If Above4 Then
Cond4 = 10000
Elsif Under4 Then
Cond4 = 20000
Endif
Cond1 = 9000
If Above1 Then
Cond1 = 1000
Elsif Under1 Then
Cond1 = 2000
Endif
Cond30 = 900
If Above30 Then
Cond30 = 100
Elsif Under30 Then
Cond30 = 200
Endif
Cond15 = 90
If Above15 Then
Cond15 = 10
Elsif Under15 Then
Cond15 = 20
Endif
AboveALL = AboveW + AboveD + Above4 + Above1 + Above30 + Above15
UnderALL = UnderW + UnderD + Under4 + Under1 + Under30 + Under15
CondALL = 9
If AboveALL = 111111 Then
CondALL = 1
Elsif UnderALL = 222222 Then
CondALL = 2
Endif
Result = CondW + CondD + Cond4 + Cond1 + Cond30 + Cond15 + CondALL
If Result = 9999999 Then
Result = 0
Endif
Screener[Result](Result AS “WD4135A”)
This will return 1 when MACD crosses over 0, 2 when it crosses under 0, for any of the following TF’s:
W=weekly
D=daily
4=4 hour
1=1 hour
3=30 minutes
15=15 minutes
A=all TF’s at the same time, same direction
I could not test it.
Very similar to what I came up with!
result = 0
timeframe(weekly)
a = MACD[12,26,9](close)
c1 = a > 0 and a[1] < 0
c2 = a < 0 and a[1] > 0
if c1 then
result = result + 100000
endif
if c2 then
result = result + 200000
endif
timeframe(daily)
a = MACD[12,26,9](close)
c1 = a > 0 and a[1] < 0
c2 = a < 0 and a[1] > 0
if c1 then
result = result + 10000
endif
if c2 then
result = result + 20000
endif
timeframe(4 hour)
a = MACD[12,26,9](close)
c1 = a > 0 and a[1] < 0
c2 = a < 0 and a[1] > 0
if c1 then
result = result + 1000
endif
if c2 then
result = result + 2000
endif
timeframe(1 hour)
a = MACD[12,26,9](close)
c1 = a > 0 and a[1] < 0
c2 = a < 0 and a[1] > 0
if c1 then
result = result + 100
endif
if c2 then
result = result + 200
endif
timeframe(30 minute)
a = MACD[12,26,9](close)
c1 = a > 0 and a[1] < 0
c2 = a < 0 and a[1] > 0
if c1 then
result = result + 10
endif
if c2 then
result = result + 20
endif
timeframe(15 minute)
a = MACD[12,26,9](close)
c1 = a > 0 and a[1] < 0
c2 = a < 0 and a[1] > 0
if c1 then
result = result + 1
endif
if c2 then
result = result + 2
endif
SCREENER[result](result as "Result")
Mine returns a 1 in any position for a cross under and a 2 for a cross over. From weekly down to 15 minute for all your chosen time frames. So 10000 = a weekly cross under and 00020 a 30 minute cross over. 22222 is a crossover in all time frames.