Cross Over Indicator HELP please
Forums › ProRealTime English forum › ProBuilder support › Cross Over Indicator HELP please
- This topic has 45 replies, 3 voices, and was last updated 1 year ago by JS.
-
-
12/29/2017 at 2:44 AM #56777
Hi Nicolas and all,
I have tried to create a simple EMA crossover indicator where it gives me an Arrow up or down once crossover happened. I really want to add somthing to this..
all in 15 min chart.. lets say after the crossover i would wait until 5 bars on 15 min and enter 5 pips below the low or 5 pips above the high within that 5 candles sticks? please see the attached pic!!
I just need a small line (with the price if possible).. 5 pips below the lowest point 0f that 5 candles (once 9 cross under 40) on 15 min chart!!! see the pic attached!!
please if you can kindly check this below and help me creating this.. i’d really appreciate it..
fast = ExponentialAverage[9](close)
slow = ExponentialAverage[40](close)//first arrow is blueish
if fast crosses over slow then
cross = slow[1]
DRAWARROWUP(barindex,LOW-5*pointsize) COLOURED(0,255,10)
endif//next arrows are purple and semi transparent
if fast>slow AND slow<>cross then
DRAWTEXT(“*”,barindex, slow) COLOURED(0,204,0)
endif//first arrow is blueish
if fast crosses under slow then
cross = slow[1]
DRAWARROWDOWN(barindex,HIGH+5*pointsize) COLOURED(255,0,10)
endif//next arrows are purple and semi transparent
if fast<slow AND slow<>cross then
DRAWTEXT(“*”,barindex, slow) COLOURED(255,0,0)
endifRETURN
12/29/2017 at 9:48 AM #5678312/29/2017 at 11:03 AM #56787😉
1234567891011121314151617181920212223242526fast = ExponentialAverage[9](close)slow = ExponentialAverage[40](close)//first arrow is blueishif fast crosses over slow thencross = slow[1]DRAWARROWUP(barindex,LOW-5*pointsize) COLOURED(0,255,10)endif//next arrows are purple and semi transparentif fast>slow AND slow<>cross thenDRAWTEXT(“*”,barindex, slow) COLOURED(0,204,0)endif//first arrow is blueishif fast crosses under slow thencross = slow[1]DRAWARROWDOWN(barindex,HIGH+5*pointsize) COLOURED(255,0,10)endif//next arrows are purple and semi transparentif fast<slow AND slow<>cross thenDRAWTEXT(“*”,barindex, slow) COLOURED(255,0,0)endifRETURN12/29/2017 at 5:19 PM #56826Sorry still new to this!
is it possible to creatvthe the line to 5pips below the lowest of 5 candles??
12/29/2017 at 6:13 PM #56829I modified the above code so that it does not display dots and does not display lines if more than one arrow occurs before 5 candles have elapsed (no matter what direction they are):
12345678910111213141516171819202122232425262728293031323334353637383940414243DEFPARAM CalculateOnLastBars = 1000fast = ExponentialAverage[9](close)slow = ExponentialAverage[40](close)//first arrow is blueishCrossOver = fast crosses over slowIF CrossOver THENCrossUnder = 0//cross = slow[1]DRAWARROWUP(barindex,LOW-5*pointsize) COLOURED(0,255,10)endifIF CrossOver[5] THENIF summation[4](CrossOver OR CrossUnder) = 0 THENTopLine = highest[5](high) + (5 * pipsize)DRAWTEXT("---#TopLine#---",barindex-3,TopLine,SansSerif,Bold,16)coloured(153,0,0)ENDIFENDIF//next arrows are purple and semi transparent//if fast>slow AND slow<>cross then//DRAWTEXT("*",barindex, slow) COLOURED(0,204,0)//endif//first arrow is blueishCrossUnder = fast crosses under slowif CrossUnder thenCrossOver = 0//cross = slow[1]DRAWARROWDOWN(barindex,HIGH+5*pointsize) COLOURED(255,0,10)endifIF CrossUnder[5] THENIF summation[4](CrossOver OR CrossUnder) = 0 THENBottomLine = lowest[5](low) - (5 * pipsize)DRAWTEXT("---#BottomLine#---",barindex-3,BottomLine,SansSerif,Bold,16)coloured(153,0,0)ENDIFENDIF//next arrows are purple and semi transparent//if fast<slow AND slow<>cross then//DRAWTEXT("*",barindex, slow) COLOURED(255,0,0)//endifRETURNRoberto
1 user thanked author for this post.
12/30/2017 at 5:20 PM #56881Nice work Robertogozzi but it gets a bit confusing to work out which is the top line and which is the bottom line when they are the same colour – better to make them green and red for easier identification I think.
1 user thanked author for this post.
12/30/2017 at 5:56 PM #56885You can select any colour from this table, just change the RGB values in the code
https://www.prorealcode.com/documentation/coloured/
1 user thanked author for this post.
12/30/2017 at 9:35 PM #56893Hi Roberto,
Thanks very much for this.. I was trying to get this right for the past three weeks!! i thnk you made a better version too.. i think i can change the colours, EMAs etc..!! thank you!!
is there a place that I can learn about cording?
12/31/2017 at 12:51 AM #56918You can browse documentation and topics for subjects of interest to you with lots of example code.
Nicolas made a few videos but I think they are in French.
You can alsotry to search YouTube or the web for video lessons.
Luckily PRT uses a very simple Language, compared to common computer languages and you should find it not too difficult to find out how to use, and when, constructs like IF…ENDIF or FOR…NEXT.
1 user thanked author for this post.
12/31/2017 at 12:53 AM #56920Another way to learn is just…. asking this forum, like you did!
12/31/2017 at 12:55 AM #56921I learnt a lot from this forum… Thanks again! 🙂
01/03/2018 at 9:22 PM #57194Screener for this?? please check if this is correct? please!!12345678910111213indicator1 = ExponentialAverage[9](close)indicator2 = ExponentialAverage[40](close)c1 = summation [10] (indicator1 CROSSES OVER indicator2)SCREENER[c1] ((close/DClose(1)+0)*15 AS "EMA X")indicator1 = ExponentialAverage[9](close)indicator2 = ExponentialAverage[40](close)c1 = summation [10] (indicator1 CROSSES UNDER indicator2)SCREENER[c1] ((close/DClose(1)-2)*15 AS "EMA X")Hi Roberto,
I have managed to create a screener for this but not sure it’s 100% correct? I wanted to get the signal when it’s crossover or under saying EMA X 15 or -15 as an up trend (15)or down trend (-15)..
also just wanted to know is there a was when its cross over or under.. we get an arrow up or down on the screener?
problem with my screener is… (lets say if it crossover? and then cross under with few candles.. it will still for and crossover)
please if I can get your expertise would be great!
Thanks
RO
01/04/2018 at 12:26 AM #57212- a screener can only contain the keyword SCREENER once, so line 6 must be removed
- lines 8-9 are duplicates and can be removed
- line 10 sould use c2 instead of c1
- line 13 should read ‘SCREENER[c1 or c2] ( c1 or c2 AS “EMA X”)’
- lines 6 and 13 are not so clear, what do you mean by EMA X and what do you expect those expressions to return?
- what use is number 10 within brackets in lines 3 and 10? It means that the last 10 candlesticks are scanned to verify a matching condition, but C1 and C2 could both be true… is that what you want?
I need those details to show you something working, but I can anticipate something
1234567891011121314ONCE Bars = 5indicator1 = ExponentialAverage[9](close)indicator2 = ExponentialAverage[40](close)c1 = summation[Bars](indicator1 CROSSES OVER indicator2) > 0c2 = summation[Bars](indicator1 CROSSES UNDER indicator2) > 0Result = 0IF c1 AND c2 THENResult = 2ELSIF c1 THENResult = 1ELSIF c2 THENResult = -1ENDIFSCREENER[result] (result AS "EMA X")Also, screener cannot draw any graphics. It can only display numbers. In such a case we can tell OVER from UNDER by 1, -1 or 2 when c1 AND c2 are both true.
01/08/2018 at 11:45 PM #57824Hi Roberto,
sorry for the late and thank you for your support again!
c1 = summation [10] is for past 10 candles sticks. I think the one you made is for past 5 candles? and when 5 candles gone the screener will disappear i guess? i want it to be on the screen for 10 bars.. is the below one correct for that?
let’s say it cross over to go up and it will show on the screener as 1 and then will stay for next 10 bars? if it crosses back under to go down again within that 10 bars will show as 2? and if after 10 bars if it crosses under to go down will show as -1?
thanks for your patience.
RO
1234567891011121314ONCE Bars = 10indicator1 = ExponentialAverage[9](close)indicator2 = ExponentialAverage[40](close)c1 = summation[Bars](indicator1 CROSSES OVER indicator2) > 0c2 = summation[Bars](indicator1 CROSSES UNDER indicator2) > 0Result = 0IF c1 AND c2 THENResult = 2ELSIF c1 THENResult = 1ELSIF c2 THENResult = -1ENDIFSCREENER[result] (result AS "EMA X")01/09/2018 at 12:23 AM #57831Yes, when both crossings have occurred within the last “Bars” (5, 10 or whatever 0ther number you want) bars 2 will be returned; when only the crossing upwards occured it will return 1, -1 when it’s southbound and Zero when no crossing occurred at all.
-
AuthorPosts
Find exclusive trading pro-tools on