EA with multiple BB
Forums › ProRealTime English forum › ProOrder support › EA with multiple BB
- This topic has 4 replies, 2 voices, and was last updated 2 years ago by robertogozzi.
-
-
10/01/2021 at 1:44 PM #178890
Hello,
I want to create a EA who trade off multiple Bollinger Band
I have 3 BB
The normal BB (50:2) (Average 50 -3*Standart Deviation)
The seconde BB (50:3)
And the last BB (50:4)
I have also 2 more filter : Stochastic (14,3,3) and RSI(8)
For an entry here are the rules
The low = inferior BB(50:3) & Stochastic (14,3,3) under 20 & RSI(8) under 30
the stop loss is inferior BB(50:4), who don’t move.
The exit rule is high = middle BB(50:2)
Can please someone help me with that code ?
I will share the results with all here
Thank you
10/07/2021 at 4:28 PM #179197There you go:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758DEFPARAM CumulateOrders = false//-------------------------------------------------------------------------// Bollinger Bands 1ONCE BBperiods1 = 50 //50 BB periodsONCE BBdev1 = 2.0 //2.0 BB deviationONCE AvgType1 = 0 //0=sma, 1=ema, etc...BBavg1 = average[BBperiods1,AvgType1](close) //BB mean (middle line)BollUP1 = BBavg1 + ((std[BBperiods1](close)) * BBdev1)//BB Upper BandBollDN1 = BBavg1 - ((std[BBperiods1](close)) * BBdev1)//BB Lower Band//-------------------------------------------------------------------------// Bollinger Bands 2ONCE BBperiods2 = 50 //50 BB periodsONCE BBdev2 = 3.0 //3.0 BB deviationONCE AvgType2 = 0 //0=sma, 1=ema, etc...BBavg2 = average[BBperiods2,AvgType2](close) //BB mean (middle line)BollUP2 = BBavg2 + ((std[BBperiods2](close)) * BBdev2)//BB Upper BandBollDN2 = BBavg2 - ((std[BBperiods2](close)) * BBdev2)//BB Lower Band//-------------------------------------------------------------------------// Bollinger Bands 3ONCE BBperiods3 = 50 //50 BB periodsONCE BBdev3 = 4.0 //4.0 BB deviationONCE AvgType3 = 0 //0=sma, 1=ema, etc...BBavg3 = average[BBperiods3,AvgType3](close) //BB mean (middle line)BollUP3 = BBavg3 + ((std[BBperiods3](close)) * BBdev3)//BB Upper BandBollDN3 = BBavg3 - ((std[BBperiods3](close)) * BBdev3)//BB Lower Band//-------------------------------------------------------------------------// StochasticMyStoch = Stochastic[14,3](close)//-------------------------------------------------------------------------//// RsiMyRsi = Rsi[8](close)//-------------------------------------------------------------------------// Entry conditionsc1 = low < BollDN2c2 = MyStoch < 20c3 = MyRsi < 30// Exit conditionsd1 = high <= BBavg1//-------------------------------------------------------------------------// enter a positionIF c1 AND c2 AND c3 AND Not LongOnMarket THENBUY 1 CONTRACT AT MarketSL = abs(close - BollDN3)SET STOP LOSS SLENDIF// update Stop Loss according to TRADEPRICE (instead of close) when knownIF LongOnMarket AND Not LongOnMarket[1] THENSL = abs(TradePrice - BollDN3[1])SET STOP LOSS SLENDIF// exit any open positionIF d1 AND LongOnMarket THENSELL AT MarketENDIF////graphonprice TradePrice//graphonprice TradePrice - SL2 users thanked author for this post.
10/19/2021 at 10:04 PM #17999110/19/2021 at 10:23 PM #179993Hello Roberto,
I test the EA, but every trade in only on 0 or 1 minutes.
The trade close right after entry.
Here a snapshot of a single positionThe right order from this example is open at your entry, but the stop loss is on BB3 (yellow). And this entry, normally close after
I hope that the snapshot will help
Thank you
10/22/2021 at 11:43 AM #180170Replace line 39 by:
1d1 = high >= BBavg1 -
AuthorPosts
Find exclusive trading pro-tools on