Double bottom or double top
Forums › ProRealTime English forum › ProOrder support › Double bottom or double top
- This topic has 47 replies, 1 voice, and was last updated 3 years ago by steve_.
Tagged: double bottom, double top
-
-
10/20/2017 at 3:07 PM #50073
Thanks for your replies , to test the code I need to add buy and sell condition.
the code is for returning the values
how to add to this buy and sell condintons
example
buy 1 perpoint at support stop
sellsshort 1 perpoint at resistance stop
10/21/2017 at 12:29 AM #5009610/21/2017 at 8:41 PM #50157Yes, right Nicolas! another way can be with a slope of a triangle between two maximums/minimus
If we learn to analyse the history of the locals minimums and locals maximum, then we can detects not only doble top/bottoms but channels, triangles, even head and shoulders!!!
And getting an issue that some minimums and maximum in certain cases are duplicated therefore cause a false signals of doble bottoms/top… anyway there is a lot work to do.
10/21/2017 at 8:49 PM #50158Leo how will put this indicator into a automated system , buy on arrow up and sell on arrow down?
No, we have the study how the arrows behave and get a profitable robot! 🙂
10/22/2017 at 9:05 PM #50259Hi all,
Here my first approximation… I feel very optimistic about this approach although there is a lot work to do (that’s why there is not algorithm to detects double bottom/tops yet )
Please see the picture attached, the triangle is draw by the algorithm here:
Double Top and bottoms123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384//LOCALS MINIMUMS AND MAXIMUMSKdouble=0.1 //Factor for defining what is double top or bottom//Leo Moving Average, formula: LMA= WMA+(WMA-SMA)LMA=2*weightedaverage[period](close)-average[period](close)//Smoothed curve of Leo Moving AverageIF BARINDEX > period THENsmoothLMA=weightedaverage[period](LMA)ELSEsmoothLMA=undefinedENDIF// << Storage of minimums and maximums >>once mintemp=lowonce posmintemp=1once maxtemp=highonce posmaxtemp=1IF BARINDEX>1 THEN// the value 0.75 is to ensure that the donchian channel is faster than the curves analysis (this value to be checked)IF low < lowest[round(0.75*period)](low[1]) THENmintemp=low //minimum temporalposmintemp=BARINDEX //postition of minimum temporalENDIFIF high > highest[round(0.75*period)](high[1]) thenmaxtemp=high //maximum temporalposmaxtemp=BARINDEX //position maximum temporalENDIFENDIF// << Detecting and locating a local minimums >>// Where the LMA is crossing the smoothed LMA, there is a maximum or minimum nearby// If there is a new local min/max, the preivus one is stored in de varible B... (before)once LEVMIN=lowonce POSLEVMIN=1once LEVMAX=highonce POSLEVMAX=1IF LMA crosses over smoothLMA THENBLEVMIN=LEVMIN //previus local minimum is savedBPOSLEVMIN=POSLEVMINLEVMIN=mintempPOSLEVMIN=posmintempsupport=LEVMINDRAWARROWUP(POSLEVMIN,LEVMIN) coloured(0,0,0,30)ENDIF// --> Detecting and locating a local maximumIF LMA crosses under smoothLMA THENBLEVMAX=LEVMAX //previus local maximum is savedBPOSLEVMAX=POSLEVMAXLEVMAX=maxtempPOSLEVMAX=posmaxtempresistance=LEVMAXDRAWARROWDOWN(POSLEVMAX,LEVMAX) coloured(0,0,0,30)ENDIFsupport=min(low,support)resistance=max(high,resistance)// << DETECTING DOUBLE TOP OR BOTTOMS >>once WidthDoubleTop = high-lowonce WidthDoubleBottom = high-low//--> Double bottomsIF LMA crosses over smoothLMA THENWidthDoubleBottom = LEVMAX-(BLEVMIN+LEVMIN)/2 // local max minus average of the las two local minIF abs(BLEVMIN-LEVMIN) < Kdouble*WidthDoubleBottom THENDRAWTRIANGLE(POSLEVMIN,LEVMIN,POSLEVMAX,LEVMAX,BPOSLEVMIN,BLEVMIN) COLOURED(0,255,0,200)ENDIFENDIF//--> Double topsIF LMA crosses under smoothLMA THENWidthDoubleTop=(BLEVMAX+LEVMAX)/2 -LEVMINIF abs(BLEVMAX-LEVMAX) < Kdouble*WidthDoubleTop THENDRAWTRIANGLE(POSLEVMIN,LEVMIN,POSLEVMAX,LEVMAX,BPOSLEVMAX,BLEVMAX) COLOURED(255,0,0,200)ENDIFENDIFRETURN LMA AS "LMA", support as "support", resistance as "resistance", smoothLMA as "smooth LMA" //, lowest[round(0.75*period)](low[1]), highest[round(0.75*period)](high[1])10/23/2017 at 8:16 AM #5027410/23/2017 at 8:25 AM #50276Hi Leo
your code is for screen return
my coding knowledge is poor add a buy condition and sell condition by removing screen retrun
can you advice me
where to add and how to add
x=5
buy 1 perpoint at resistance+x stop
sellshort 1 perpoint at support -x stop
I will change the other conditions after back testing. x=5 and buy condition etc are example only
after back testing I will post my results
10/23/2017 at 1:24 PM #5031710/23/2017 at 9:13 PM #50343Hi all,
Madrosat, so far I am developing an algorithm for detecting double top or bottoms. For trading is more or less what Rama says: instead of drawing a triangle, it will be the executing order or a boleean or whatever.
Rama, right now I do not know how is the executed a trade, the theory is (for long)
– entry above the resistance
– stop loss below the support
– stop profit at a distance of Resistance – support i.e. a trade with profit/risk ratio of one
… that’s the theory maybe we can entry on the market earlier and take more profit
Abz, odd that error. What I notice is that some arrows are duplicated ( or repeated), try my last version, please and tell us if it is better.
10/24/2017 at 9:16 PM #50419Hey,
I made an algorithm for detecting double top and double bottoms and is working so awesome and I feel so proud of it that I put it in the library as an indicator. Have a look to it when @Nicolas validate it for posting… and please give it a like or comment it, I want to improve my ranking in this forum 🙂
I think my algo is promising and I hope we work together for make the proper modification for automatic trading.
1 user thanked author for this post.
10/25/2017 at 6:53 PM #5052010/25/2017 at 7:15 PM #5052110/25/2017 at 9:23 PM #50535Thanks, those message encourage me for continuing my endeavour.
Here is my detector:
https://www.prorealcode.com/prorealtime-indicators/double-top-double-bottom-detector/
Now we have to found a clever way to employ that detector…
10/26/2017 at 1:45 PM #5060610/26/2017 at 5:28 PM #50635Hi Madrosat,
around line 20 of the code, says:
// the value 0.75 is to ensure that the donchian channel is faster than the curves analysis (this value to be checked)
I thought this solve the issue, but no…. hope we find another way no repeating the arrows (I.e duplicating the information of a local maximum or minimum)
-
AuthorPosts
Find exclusive trading pro-tools on