MQL4 - automated forex trading   /  

Code Base

Code Base  Expert Advisors  RUBBERBANDS_3 EA To post a new code, please log in or register

Library of programs in the new MQL5
Prepare for the Championship

This Expert Advisor is for
MetaTrader 4
Download MT 4 - 5.5 Mb

Mobile trading!
Buy a license and be mobile in your trading!

Name:
RUBBERBANDS_3 EA
Author: StJojo (2009.08.26 07:01)
Rating: 5.5
Downloaded: 4304
Download:
 RUBBERBANDS_3.mq4 (12.4 Kb) View

RUBBERBANDS_3 EA

Version 1.0

This EA is intended to be less prone to big drawdowns than former RUBBERBANDS EA and RUBBERBANDS_2 EA. Awaiting your comments and suggestions for improvement.

The basic idea is the same as its predecessors, RUBBERBANDS EA and RUBBERBANDS_2 EA, it works in any timeframe for any currency pair, preferrably, EUR/USD, GBP/USD, and USD/CHF.

It opens orders in both directions (BUY & SELL) at a time initially, then opens an additional order in the forward direction everytime the price goes up or down, i.e., opens an additional BUY order everytime the price goes up by multiples of "pipstep" above the initial BUY order, and opens an additional SELL order everytime the price goes down by multiples of "pipstep" below the initial SELL order (this is opposite to RUBBERBANDS_2 EA).

When the price goes back from the lastly-placed order by "backstep" pips, it closes all the orders in the "forward" direction and opens a reverse order. At this time, there are only two orders left in the "backward" direction.

It closes those two outstanding orders when the specified profit "sessionTP" (in dollars) is reached, which functions as TAKEPROFIT, or, if set so ("use_sessionSL"==true), when the specified loss "sessionSL" (in dollars) is reached, which functions as STOPLOSS.

The opening of the initilal orders through the closure of all outstanding orders constitutes one "session".

The external variable "maxcount" limits the number of orders per session.

Use Strategy Tester to see how this EA performs.

Preferred currency pairs: EUR/USD, GBP/USD, and USD/CHF.

External variables are:

Lots = 0.02 (number of lots for each order)

maxcount = 10 (maximum number of orders allowed in one session)

pipstep = 100 (pip distance to place additional BUY or SELL orders in "forward" direction)

backstep = 20 (pip distance from the lastly-placed order to close all the orders in "forward" direction and place a reverse BUY or SELL order in "backward" direction)

quiescenow = false (if true, quiesces this EA when the current session ends)

donow = false (if true, opens orders immediately)

stopnow = false (if true, stops this EA)

closenow = false (if true, closes all outstanding orders)

use_sessionTP = true (don't change this)

sessionTP = 2000 (profit in dollars per lot to close all outstanding orders; functions as TAKEPROFIT)

use_sessionSL = true (If true, uses "sessionSL" below)

sessionSL = 4000 (loss in dollars per lot to close all outstanding orders; functions as STOPLOSS)

The following three external variables are for restarting this EA after, say, the weekend, when there are outstanding orders. "inmax" and "imin" are displayed as "GLBmax" and "GLBmin" on the chart.

useinvalues = false (set to true on restart)

inmax = 0 (set former max on restart)

inmin = 0 (set former min on restart)

23 comments: 1 2 3   To post a new comment, please log in or register
btherichb wrote:

the older rubberbands were different from this. version two is better than thix. thanks for your works. (btherichb@yahoo.com)

Can someone post a set file for any of these rubberbands EAs that is profitable. I have yet to find anything that doesnt blow the acct on any version. Thanks!!


27.12.2009 04:39 metalriff

the older rubberbands were different from this. version two is better than thix. thanks for your works. (btherichb@yahoo.com)

26.12.2009 23:56 btherichb

Another big problem is that none of the calculating or close functions are <magic number safe>....

So if this is used with other EA's or trades in the same account - it will close those trades unexpectedly :(

02.12.2009 22:19 BarrowBoy

Should review this, Orders should be closed from highest index position backwards as the index array is renumbered when an order is closed

So in function close1by1...

for(cnt=0;cnt<total;cnt++)

should be

for (cnt=OrdersTotal()-1; cnt>=0; cnt--)

And...

I still think this should not be used on the majors but would work better on the ranging crosses, EURCHF, EURCAD and GBPCHF

Ooops - sorry bout that - didnt RTFM - the opening logic is reversed in this version, so the strong movers are OK :)

Good Luck

-BB-

30.11.2009 16:06 BarrowBoy

can anyone create an expert advisor that will follow watever the parbolic sar(indicator

) says??

28.09.2009 19:12 1163657

I am having a problem getting this code to strategy test. Do i have to change some external variables or something else?

08.09.2009 19:25 08201970
StJojo wrote:
Mr.Mc wrote:

Hello StJojo and thank you sincerely, for your effort with this EA. I currently have Blessing, Pip Maker, Unequal Hedge, and of course, Rubberbands :)

I love the grid type system because, too me, it's the only thing that makes sense. NO ONE knows which direction the market is going to go. I've been rolling an idea around in my head here about pip steps. I don't like a fixed number being pulled out of the blue and utilized. Why is pip step 50? Some programs use Average True Range/Standard Deviation, some don't. My idea is to use previous bar highs and previous bar lows. Would that work? This would be a larger time frame option of course, because a TF below H1 would probably drain the margin.

Do you think using previous bar highs and previous bar lows could be used for pip steps?

Regards

Mr.MC

Ummm..dynamic pip step..it never occurred to me and I like it. I'm still trying to improve RUBBERBANDS, -2, and -3, and while doing so, I will put your idea into the code as an option when new property "use_previous_HL"==true.


Yes a dynamic pip step based on bar highs and lows. Bar highs and lows are important psychological benchmarks in the trading world. I think they could be used very effectively as pip step markers. We could even use different TF's. If your trading a 4H chart, the steps could be based on 1H highs/lows within a 4H candle. Highs and lows could also serve as TP points. The grid could draw off of highs and lows. All kinds of angles could be made based on Highs and Lows. Will look to see if this works out. Thanks for the opportunity to chip in.

Mr.MC

06.09.2009 21:58 Mr.Mc
Pat1 wrote:
Is it possible to use the exe file for live trades?Is it by default designed for use with the strategy tester? Going through the code of the variable dll, 97 is a buy, 98 is a sell and 9 is a closeall open orders. The exe, based on the pressing of the buttons, Buy Sell and Close places a 1 for variable 97 etc. Could this be used in EA for live trading? Excellent concept ot trade manually. Good Job.
Pat

Sorry, Wrong Thread!


04.09.2009 18:25 Pat1
Is it possible to use the exe file for live trades?Is it by default designed for use with the strategy tester? Going through the code of the variable dll, 97 is a buy, 98 is a sell and 9 is a closeall open orders. The exe, based on the pressing of the buttons, Buy Sell and Close places a 1 for variable 97 etc. Could this be used in EA for live trading? Excellent concept ot trade manually. Good Job.
Pat

04.09.2009 18:24 Pat1
StJojo wrote:

Hi there. I'm sorry and I have to adimit that this EA is not up to anybody's expectations. I've been doing lots of "head games" for improvements, though ... to no avail. Well, I will update this one by implementing your ideas and suggestions. Currently, I'm using the initial RUBBERBANDS for live trading, which is the most profitable among three. Anyway we have to reduce risks associated with any EA.

I found your inital version the best. Cld u explain what is the difference in the strategies that makes the first version more profitable? thks


28.08.2009 17:24 ronaldosim