I hope someone can help. I’m trying to create a indicator which alerts on the 1hr time-frame for bullish or bearish cross over of the previous days close. My current code is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
res=0
pdc=dclose(1)
Timeframe(1hour)
a1=closecrosses overpdc
long=a1[1]
Timeframe(1hour)
b1=closecrosses underpdc
short=b1[1]
iflongthen
res=1
elsifshortthen
res=-1
endif
screener[(long)or(short)](resas"direction")
I need help to ensure it only triggers based on the previous hour. The results seem random when executed against the currencies market. Can someone help?
You are over complicated the code, I think it could work like this, and running it on the 1-hour timeframe. Dclose is a constant that you can use in any timeframe.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue