Need help with coding please - page 6

 

One more request for code help!

Sorry to be such a leech to all you coders out there, but I have second request, if possible, for help with code - this time I have code attached but I need one alteration to it if possible.

I used "Expert Adviser Builder" to build these 2 simple MA crossover EAs - one for Buy and one for Sell. They are as simple as I guess you can get!

But I really need them to only ever enter a trade if there are currently no open trades for the symbol they are attached to.

So if EURUSD already has even just 1 open trade already, then I need these EAs to do nothing on a EURUSD chart despite any MA crosses. Only if I manually exited all EURUSD positions would these EAs then enter upon the next MA cross.

I hope that makes sense.

As ever, any help would be gratefully received

Thanks for your time

Files:
sell_ea_2.mq4  10 kb
buy_ea_2.mq4  10 kb
 
Pine111:
Sorry to be such a leech to all you coders out there, but I have second request, if possible, for help with code - this time I have code attached but I need one alteration to it if possible.

I used "Expert Adviser Builder" to build these 2 simple MA crossover EAs - one for Buy and one for Sell. They are as simple as I guess you can get!

But I really need them to only ever enter a trade if there are currently no open trades for the symbol they are attached to.

So if EURUSD already has even just 1 open trade already, then I need these EAs to do nothing on a EURUSD chart despite any MA crosses. Only if I manually exited all EURUSD positions would these EAs then enter upon the next MA cross.

I hope that makes sense.

As ever, any help would be gratefully received

Thanks for your time

Hi Pine111,

For your last request made this version should work for both buys and sells one thing to remember with this, there is a maxorders feature by default it is set to 1, like this the Ea should do as you are talking about. BTW this is the same as the buy and sell Ea's you posted just combined, and has a little more updated features.

About your first request not sure how to do this yet, when I do will combine it with this Ea if you like.

Files:
 
mrtools:
Hi Pine111,

For your last request made this version should work for both buys and sells one thing to remember with this, there is a maxorders feature by default it is set to 1, like this the Ea should do as you are talking about. BTW this is the same as the buy and sell Ea's you posted just combined, and has a little more updated features.

About your first request not sure how to do this yet, when I do will combine it with this Ea if you like.

Wow thanks for your help!

If the buy and sell instructions on the EA are combined, I saw there is an option in the grey box (which comes up when I attach the EA) which says "long only" "short only" and "long & short" - so I can just use that as a filter as necessary - brilliant!

As for the first request, I'm very very grateful you are helping me - but if possible could it be a separate EA rather than combining the two? I'm sure I can run EAs alongside each other on the same chart (I think?!) and it would be easier for me to keep them as separate EAs, strangely enough!

Again, many thanks for your help!!!

 

Update from last post:

ok sorry I just realised I can't load two EAs onto same chart at once... so please disregard what I said about them being separates, please do combine the breakeven feature if possible into the first EA you gave me! If possible, a simple "true/false" option would be ideal to turn the breakeven function on and off would be good, so the EA will still enter on cross regardless of the breakeven function being on or off.

Sorry to be a pain I know you are spending time doing this.

Thanks a bunch!!!

:)

 

EA coding

Hello everyone,

Do you know an existing EA (already written EA) that would trade like that:

The first trade is placed by the EA based on a set of variables. If the trade ends up in a profit then the next trade is again placed with the same position size and direction (long or short). And, if this trade also ends up in profit then the EA will place another trade with the same position size and direction. This will continue till EA encounter a losing trade.

Once the EA faces a losing trade or the EA meet the opposite set of variables , the EA will place a trade in the opposite direction of previous trade and also the position size will increase to the predefined multiple in the variables. If this trade also ends up in a losing trade then EA will place the next trade in the opposite direction of the previous trade and also the position size will be a multiple of the previous trade. This will continue till the EA faces a winning trade or it reaches predetermined number of losing trades in the variables.

A kind of oscillating lot size around an MACD for instance, or something equivalent...

Am I clear?

Thanks everyone for your reply and experience in that matter.

Tomcat

 

Auto Pending Order on MA Line/Price EA

Hello reliable EA gurus in da house.....please can anyone help me code an EA that sets automatic pending order on an MA line/price with sl and tp with the MA visible on the chart? What I want is when price is above the MA, the EA should set automatic buy pending order on the MA line/price on every new candle opening until it is triggered and if price is below the MA it should plot automatic sell pending order on the MA line/price on every new candle opening until it is triggered. For instance if I put the EA on 15mins tf, it should plot a new pending order every 15mins on the MA line/price until it is triggered....same thing for all timeframes. When the pending order is triggered, the EA should automatically disable and can only be enabled manually again. Hope you understand? Thanks alot.

 

Please help me with this

Can anyone create an EA (ex4) with the following?

I have NO experience in this.

Present bid <= previous bar low. AND

Previous bar high is maximum of last 10 bars (IF POSSIBLE user input for number of bars)

Sell at previous bar low

Stop Loss (User input in pips)

Take Profit (User input in pips)

OR

Present bid >= previous bar high. AND

Previous bar low is minimum of last 10 bars (IF POSSIBLE user input for number of bars)

Buy at previous bar high

Stop Loss (User input in pips)

Take Profit (User input in pips)

I really appreciate your help,

Thanks

 

Plotting increase volume on price bars

Hi,

I have no MQL coding experience, and am asking for help to create the following indicator:

Using the standard volume indicator in MT4, I would like the "Volume Plot" indicator to plot a small horizontal line, slightly wider than a price bar, at the median price of any particular interval that has greater volume than the previous interval.

Indicator would essentially plot dashes on the chart, at the median price of the interval (HL/2) on any interval where the volume was greater (by any amount) than the previous interval.

Optimal configuration would be for the indicator to plot a small horizontal line (or dash) for every interval at the median price, but have the choice for two colors. Color 1 would be for decreasing volume than the previous interval. Color 2 would be for increasing volume than the previous interval.

If anyone is familiar with Martin Cole's PAT (Professional Activity Tracker) software, this indicator in Metatrader 4 would help a trader see the price intervals on the chart that have increased volume, and where it's median price is compared to the the previous interval(s).

I can provide PAT screenshots if needed.

 

Need help to create my EA

Hi Hi everyone, I need someone to help me write this EA please, with below conditions:

1- EA will make two pending orders (buy stop & sell stop) at same time.

2- Pips from the market price to pending orders buy stop / sell stop is variable I control it sometime I want to put 14 pips or 15 or 10 depending on the market situation (distance from market price to pending orders should be variable)

3- Stop loss also variable.

4- Take profit it also variable

5- Trailing stop. (in pips) Which means that once the profit hits the target, trailing stop should work for making extra profit and trailing stop should also be variable and to have the option to be enabled or disabled

6- Closing the other pending order (the opposite one) automatically after profit made, & the opposite is true which means in case one of the pending orders made loss the other order should remain

7- Trading hours: I should be able to control this EA. I want this EA to work at certain hour of the day in my local time (computer time)

8- Traded pairs, means that this EA can be attached to one pair only but it can make pending orders to pairs that I put in EA (example: if I put only EURUSD, EA should make only two pending orders, but if I put EURUSD,EURJPY,GBPUSD EA should make 6 pending orders two pending orders for each pair.

i really appreciate if someone could help me out. This is my first post and hope i get the responds

thanks you all.

 

required color code for candles

I need code for colored candles for following conditions.

( RSI( 9 ) O ) , colorRose //RSI has reached to lowest low level in 9 periods but close is greater than open

( RSI( 9 ) >= HHV( RSI( 9 ), 9 ) AND ( C < O ) , colorTurquoise , //RSI has reached to highest high level in 9 periods but close is less than open

( RSI( 9 ) <= LLV( RSI( 9 ), 9 ) , colorDarkRed , //RSI has reached lowest low level in 9 periods and close is less than open

( RSI( 9 ) >= HHV( RSI( 9 ), 9 ) , colorDarkGreen ,//RSI has reached highest high level in 9 periods and close is more than open

C > O , colorWhite ,

C<O,colorBlack

Reason: