Moving averages clustering
Forums › ProRealTime English forum › ProOrder support › Moving averages clustering
- This topic has 8 replies, 5 voices, and was last updated 6 years ago by
Leo.
Tagged: MA cluster
Viewing 9 posts - 1 through 9 (of 9 total)
-
-
07/02/2018 at 4:14 AM #75044
I posted this previously in the wrong section – see below if anyone can assist?
Does anyone know how to program up a clustering of moving averages.
I.e. I don’t want to take a trade if for example the following moving averages are within X pips together
MA(5)
MA(20)
MA(50)
MA(100)
MA(200)
Any assistance would be appreciated.
Thanks
07/02/2018 at 7:54 AM #7505307/02/2018 at 8:50 AM #75056Not tested
1234567891011x = 10 * pipsize //10-pip rangema5 = average[5,0](close)ma20 = average[20,0](close)ma50 = average[50,0](close)ma100 = average[100,0](close)ma200 = average[200,0](close)MaxMA = max(ma5,max(ma20,max(ma50,max(ma100,ma200))))MinMA = min(ma5,min(ma20,min(ma50,min(ma100,ma200))))IF (MaxMA - MinMA) <= x THEN//they are within X pipsENDIF1 user thanked author for this post.
07/02/2018 at 9:47 AM #75065Added to here Snippet Link Library
2 users thanked author for this post.
07/02/2018 at 11:25 AM #7508311/08/2018 at 6:55 AM #8438211/08/2018 at 9:32 AM #84397I never tried, but it can be worth trying.
11/08/2018 at 9:56 AM #84399This is some quick code (see attached pic):
1234567891011121314151617181920212223242526DEFPARAM CumulateOrders = falseONCE Sl = 0ONCE Tp = 0ONCE Multiplier = 2.0 //2.0 multiplies SL to set TPONCE LookBack = 2 //2 candles to set SL to low/highONCE PipRange = 10 * pipsize //10-pip rangeONCE AvgType = 6 //6 = time seriesma5 = average[5,AvgType](close)ma20 = average[20,AvgType](close)ma50 = average[50,AvgType](close)ma100 = average[100,AvgType](close)ma200 = average[200,AvgType](close)MaxMA = max(ma5,max(ma20,max(ma50,max(ma100,ma200))))MinMA = min(ma5,min(ma20,min(ma50,min(ma100,ma200))))IF (MaxMA - MinMA) <= PipRange THENIF close CROSSES OVER MaxMA THENSl = close - lowest[LookBack](low)BUY 1 CONTRACT AT MARKETELSIF close CROSSES UNDER MinMa THENSl = highest[LookBack](high) - closeSELLSHORT 1 CONTRACT AT MARKETENDIFTp = Sl * MultiplierSET TARGET PROFIT TpSET STOP LOSS SlENDIF1 user thanked author for this post.
11/08/2018 at 10:47 AM #84402 -
AuthorPosts
Viewing 9 posts - 1 through 9 (of 9 total)
Find exclusive trading pro-tools on
Similar topics: