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.
-
-
01/11/2018 at 11:08 PM #59117
Honestly, you could have just said yes or no rather than a lecture. this is not going make you a millionaire.. trading involves more than this.. just think about it.. you know cording, creating strategies etc… but still dreaming of retire on a tropical island.. just maybe.. just maybe something will happen if you change your attitude.. so learn to give more and you will get more. my philosophy :)!! I’m trying to learn to cord and to create something.. only reason Ive reached out your help!! thanks anyway and good luck!
Yes I could have just said ‘No – bugger off’ but that would have been rude. Better to explain clearly and precisely my reasoning for saying no I think. Sorry if you felt that it was a lecture.
Yes I doubt I will ever become a millionaire – I like spending too much.
I believe I give plenty and have no reason to feel ashamed on that front. Just check my posts helping others and then check out the indicators that I have posted in the library. If we are counting then I think that I am in credit.
Oh and as for the tropical island. Maybe not but as I already live on a boat in Greece it is a genuine possibility one day.
If you want a free trading system that probably doesn’t work anyway then there are plenty of people out there who will sell you one. My original post was purely to show that the indicator you requested had potential as a strategy.
Oh and by the way what is cording – something to do with string or just hanging out with people in slightly fluffy trousers?
1 user thanked author for this post.
01/11/2018 at 11:12 PM #59119Great.. Thanks 🙂
01/12/2018 at 9:23 AM #59145This version displays also green/red candles.
I’ll later try to define a range by using narrowing Bollinger Bands and display also GREY candles.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263DEFPARAM CalculateOnLastBars = 1000ONCE BullTrend = 0ONCE BearTrend = 0ONCE SideWays = 0IF SideWays THENENDIFfast = ExponentialAverage[9](close)slow = ExponentialAverage[40](close)//first arrow is blueishCrossOver = fast crosses over slowIF CrossOver THENBullTrend = 1BearTrend = 0SideWays = 0CrossUnder = 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 thenBullTrend = 0BearTrend = 1SideWays = 0CrossOver = 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)ENDIFENDIFIF BullTrend THENDRAWCANDLE(Open,High,Low,Close)coloured(0,255,0) bordercolor(0,0,0)ELSIF BearTrend THENDRAWCANDLE(Open,High,Low,Close)coloured(255,0,0) bordercolor(0,0,0)ELSEDRAWCANDLE(Open,High,Low,Close)coloured(169,169,169) bordercolor(0,0,0)ENDIF//next arrows are purple and semi transparent//if fast<slow AND slow<>cross then//DRAWTEXT("*",barindex, slow) COLOURED(255,0,0)//endifRETURN01/12/2018 at 11:35 AM #59161hi Roberto,
Thanks again. using Bollinger bands is a great idea!
On this Dark Red and Dark Green candles are missing!! see attached
Thanks
Ro
01/12/2018 at 6:30 PM #59244Missing you say… they outstand on that black background!!!
01/12/2018 at 7:36 PM #5926501/12/2018 at 8:11 PM #59275This is the current version, with Red/Green/Grey candles overriding PRT’s default colours.
I also attach the file to be imported and two screenshots, price properties and chart.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495DEFPARAM CalculateOnLastBars = 2000//ONCE FastAvg = 9 //8 TO BE UNCOMMENTED IF VARIABLE IS STATIC INSIDE THE CODE//ONCE SlowAvg = 40 //40 TO BE UNCOMMENTED IF VARIABLE IS STATIC INSIDE THE CODE//ONCE BBval = 20 //20 TO BE UNCOMMENTED IF VARIABLE IS STATIC INSIDE THE CODE//ONCE BBdev = 2.0 //2.0 TO BE UNCOMMENTED IF VARIABLE IS STATIC INSIDE THE CODEONCE BullTrend = 0ONCE BearTrend = 0ONCE SideWays = 0ONCE RangeBars = 2// Let's check all Variables are set within valid rangesFastAvg = max(min(FastAvg,99),0)SlowAvg = max(min(SlowAvg,99),0)AvgType = max(min(AvgType,6),0)BBdev = max(min(BBdev,99.9),0.1)BBavg = max(min(BBAvg,99),0)RangeBars = max(min(RangeBars,9),2)// Set up a Bollinger BandBBmean = average[BBavg,0](close) //BB mean (middle line)BollUP = BBmean + ((std[BBavg](close)) * BBdev) //BB Upper BandBollDN = BBmean - ((std[BBavg](close)) * BBdev) //BB Lower Band// Determine current Averages'valuefast = Average[FastAvg,AvgType](close)slow = Average[SlowAvg,AvgType](close)// Determine current status of BB (Narrowing or Expanding)Narrow = (BollUP < BollUP[1]) AND (BollDN > BollDN[1])Expand = (BollUP > BollUP[1]) AND (BollDN < BollDN[1])// first arrow is GreenCrossOver = fast crosses over slowIF CrossOver THENBullTrend = 1BearTrend = 0SideWays = 0CrossUnder = 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// next arrow is RedCrossUnder = fast crosses under slowif CrossUnder thenBullTrend = 0BearTrend = 1SideWays = 0CrossOver = 0//cross = slow[1]DRAWARROWDOWN(barindex,HIGH+5*pointsize) COLOURED(255,0,10)endif// Display price on the 5th bar (since the crossing)IF 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// grey bars when ranging sidewaysIF SideWays = 0 AND (summation[RangeBars](Narrow) = RangeBars) THENSideWays = 1ELSIF SideWays = 1 AND (summation[RangeBars](Expand) = RangeBars) THENSideWays = 0ENDIF// override default colour for CandlesIF SideWays THENDRAWCANDLE(Open,High,Low,Close)coloured(169,169,169) bordercolor(0,0,0)ELSIF BullTrend THENDRAWCANDLE(Open,High,Low,Close)coloured(0,255,0) bordercolor(0,0,0)ELSIF BearTrend THENDRAWCANDLE(Open,High,Low,Close)coloured(255,0,0) bordercolor(0,0,0)ENDIF//next arrows are purple and semi transparent//if fast<slow AND slow<>cross then//DRAWTEXT("*",barindex, slow) COLOURED(255,0,0)//endifRETURN01/12/2018 at 8:18 PM #59280As for DARKer colours, well… you can better than me tell what is darker or not, according to the table ( https://www.prorealcode.com/documentation/coloured/ ) that I already recommended you.
01/12/2018 at 8:26 PM #59284You will notice that on the chart sometimes candles are GREY despite beeing on the rise or fall. That depends on the number of candles you want to set to define the start/end of a sideways range (variable RangeBars), the smaller the value the more a trend is interrupted by grey candles, the greater the value the less a range can be identified when starting.
You (and anyone else interested in making this indicator better) may try to define a better way to identify the start (and end) of a ranging market, may with the use of another indicator or combining multiple indicators.
Any suggestion or improvent is highly encouraged.
01/15/2018 at 12:30 AM #59483Hi Roberto,
This is fantastic! thanks for all your hard work.. we really got something here!! what I meant by dark colours — if any downtrend the up candles to be changed to dark red like( 139,0,0) and on an uptrend any down candles to be dark green like (0,100,0).
please see attached pictures… if that makes any sense.. if we can achieve this will be completed!!
Thanks
Ro
01/15/2018 at 12:41 AM #59486There you go:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103DEFPARAM CalculateOnLastBars = 2000//ONCE FastAvg = 9 //8 TO BE UNCOMMENTED IF VARIABLE IS STATIC INSIDE THE CODE//ONCE SlowAvg = 40 //40 TO BE UNCOMMENTED IF VARIABLE IS STATIC INSIDE THE CODE//ONCE BBval = 20 //20 TO BE UNCOMMENTED IF VARIABLE IS STATIC INSIDE THE CODE//ONCE BBdev = 2.0 //2.0 TO BE UNCOMMENTED IF VARIABLE IS STATIC INSIDE THE CODEONCE BullTrend = 0ONCE BearTrend = 0ONCE SideWays = 0ONCE RangeBars = 2// Let's check all Variables are set within valid rangesFastAvg = max(min(FastAvg,99),0)SlowAvg = max(min(SlowAvg,99),0)AvgType = max(min(AvgType,6),0)BBdev = max(min(BBdev,99.9),0.1)BBavg = max(min(BBAvg,99),0)RangeBars = max(min(RangeBars,9),2)// Set up a Bollinger BandBBmean = average[BBavg,0](close) //BB mean (middle line)BollUP = BBmean + ((std[BBavg](close)) * BBdev) //BB Upper BandBollDN = BBmean - ((std[BBavg](close)) * BBdev) //BB Lower Band// Determine current Averages'valuefast = Average[FastAvg,AvgType](close)slow = Average[SlowAvg,AvgType](close)// Determine current status of BB (Narrowing or Expanding)Narrow = (BollUP < BollUP[1]) AND (BollDN > BollDN[1])Expand = (BollUP > BollUP[1]) AND (BollDN < BollDN[1])// first arrow is GreenCrossOver = fast crosses over slowIF CrossOver THENBullTrend = 1BearTrend = 0SideWays = 0CrossUnder = 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// next arrow is RedCrossUnder = fast crosses under slowif CrossUnder thenBullTrend = 0BearTrend = 1SideWays = 0CrossOver = 0//cross = slow[1]DRAWARROWDOWN(barindex,HIGH+5*pointsize) COLOURED(255,0,10)endif// Display price on the 5th bar (since the crossing)IF 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// grey bars when ranging sidewaysIF SideWays = 0 AND (summation[RangeBars](Narrow) = RangeBars) THENSideWays = 1ELSIF SideWays = 1 AND (summation[RangeBars](Expand) = RangeBars) THENSideWays = 0ENDIF// override default colour for CandlesIF SideWays THENDRAWCANDLE(Open,High,Low,Close)coloured(169,169,169) bordercolor(0,0,0)ELSIF BullTrend THENIF close > open THENDRAWCANDLE(Open,High,Low,Close)coloured(0,255,0) bordercolor(0,0,0) //light GREENELSEDRAWCANDLE(Open,High,Low,Close)coloured(0,100,0) bordercolor(0,0,0) //dark GREENENDIFELSIF BearTrend THENIF close < open THENDRAWCANDLE(Open,High,Low,Close)coloured(255,0,0) bordercolor(0,0,0) //light REDELSEDRAWCANDLE(Open,High,Low,Close)coloured(139,0,0) bordercolor(0,0,0) //dark REDENDIFENDIF//next arrows are purple and semi transparent//if fast<slow AND slow<>cross then// DRAWTEXT("*",barindex, slow) COLOURED(255,0,0)//endifRETURN1 user thanked author for this post.
01/17/2018 at 6:21 PM #59720Hi Roberto,
Thanks for this.. now need to change my numbers and test this properly!! will update you the results!!
thanks once again!
08/09/2023 at 10:27 AM #2187861c1 = (indicator1 > indicator2) or indicator2<25Hi,
Above is a condition based on indicator. How can i find the price at which the above condition becomes true? If above is a bullish cross of stochastic, can i know at what price it occurred? I would also like to know at what price the previous cross over occurred. Not sure if this is possible
thanks
PJ
08/09/2023 at 11:27 AM #218803There you go:
123IF (close CROSSES OVER MyIndicator) OR (close CROSSES UNDER MyIndicator) THENPriceAtCrossOver = closeENDIF08/09/2023 at 12:13 PM #218820thanks, this would probably give price of cross over now. Is it possible to get the price of previous cross over? Example shown in image below. I would like to know the price at those swings when indicator cross over.
thanks
-
AuthorPosts
Find exclusive trading pro-tools on