Jump to content

[REQ] Add feature to EA


Recommended Posts

Hi, Can someone please modify the following EA to do the following:

 

http://www.2shared.com/file/tmMJUuFl/MartinProfit__1_.html

 

I would like to set a profit target in dollars and once the target is reached all trades should be closed and profit taken. For example I set Profit Target to $20 and once trades are $20 in profit all trades must be closed and EA must stop trading. EA must only start trading when it is loaded again. Would be great if it could be made to start trading at 00:00 and once profit made must then stop trading and only start trading again at 00:00...

 

Been running ea for a while now and making $20 each day on $1000 account. works very well but i must disable ea and close trades manually and sometimes i miss the opportunity to do so. Any help greatly appreciated.

 

Best rgds

Link to comment
Share on other sites

You would do better using a script or keep one chart for a TradeManager EA. You can see the abundance of scripts here:

hxxp://www.forexfactory.cOm/showthread.php?t=193727&page=2 If you do a search for Trade Manager EA - I recommend you uses search string "Multi+Purpose+trade+manager+MT4" and you will find it. It is a wonderful tool.

 

I hope it is allowed to post that URL.

Edited by FxNewbie
Link to comment
Share on other sites

Try this

http://codebase.mql4.com/1727/page2, just change the code a little and it should do your work

FYI, the codes has lots of errors too, i mean the ea u uploaded, it will give errors while backtesting

Hi, Can someone please modify the following EA to do the following:

 

http://www.2shared.com/file/tmMJUuFl/MartinProfit__1_.html

 

I would like to set a profit target in dollars and once the target is reached all trades should be closed and profit taken. For example I set Profit Target to $20 and once trades are $20 in profit all trades must be closed and EA must stop trading. EA must only start trading when it is loaded again. Would be great if it could be made to start trading at 00:00 and once profit made must then stop trading and only start trading again at 00:00...

 

Been running ea for a while now and making $20 each day on $1000 account. works very well but i must disable ea and close trades manually and sometimes i miss the opportunity to do so. Any help greatly appreciated.

 

Best rgds

Link to comment
Share on other sites

Hi, Can someone please modify the following EA to do the following:

 

http://www.2shared.com/file/tmMJUuFl/MartinProfit__1_.html

 

I would like to set a profit target in dollars and once the target is reached all trades should be closed and profit taken. For example I set Profit Target to $20 and once trades are $20 in profit all trades must be closed and EA must stop trading. EA must only start trading when it is loaded again. Would be great if it could be made to start trading at 00:00 and once profit made must then stop trading and only start trading again at 00:00...

 

Been running ea for a while now and making $20 each day on $1000 account. works very well but i must disable ea and close trades manually and sometimes i miss the opportunity to do so. Any help greatly appreciated.

 

Best rgds

Here you go

http://www.worldwide-invest.org/threads/9223-REQ-Add-feature-to-EA

Link to comment
Share on other sites

EA's never stop unless forcedly removed [by system or user] - there is no legit mechanism to program physically stop of an EA since it is called on every data tick, what I can suggest is use the code from the EA in martin profit n make it sleep till next day comes

Here is a EA that close all at profit $ but don´t stop Your EA to trade. If somebody can modify it or take some code to Your EA...

http://www.4shared.com/file/F5o9SLlj/CloseAtProfit.html

Link to comment
Share on other sites

Hi, Can someone please modify the following EA to do the following:

 

http://www.2shared.com/file/tmMJUuFl/MartinProfit__1_.html

 

I would like to set a profit target in dollars and once the target is reached all trades should be closed and profit taken. For example I set Profit Target to $20 and once trades are $20 in profit all trades must be closed and EA must stop trading. EA must only start trading when it is loaded again. Would be great if it could be made to start trading at 00:00 and once profit made must then stop trading and only start trading again at 00:00...

 

Been running ea for a while now and making $20 each day on $1000 account. works very well but i must disable ea and close trades manually and sometimes i miss the opportunity to do so. Any help greatly appreciated.

 

Best rgds

Here you go...

http://www.worldwide-invest.org/threads/9223-REQ-Add-feature-to-EA

Link to comment
Share on other sites

There is a very easy way to do it actually .

tell the ea to trade only if AccountBalance() < userdefined balance .

and every day set in the inputs of the ea current balance+20 usd .

as soon as the balance goes to that level ea will be incapable of putting any new orders/trades

Anotherway to do it is , tell it on every new bar to check account balance . set as a new bar the daily tf . so you tell it , on every new bar , check account balance .

 

define a double , lets say double startingballance = AccountBalance()

 

than in the order taking logics add && AccountBalance() < startingballance +20

 

that way , on a daily basis initial account balance gets reset when a new day beggins , and the ea, after 20 usd were made for the day , can`t put any fresh trades .

Link to comment
Share on other sites

There you go . tested it , works just fine . just be aware in this setup, if you take manual trades on the account and loose, the ea will start again to work . is locking down based on account balance. so if for any reason youre account balance gets lower, ea will start again. !! Cheers.

 

http://www.2shared.com/file/Vw7TE7r3/MartinProfitcutout.html

Link to comment
Share on other sites

The safer way to "switch off" the EA after the trade for the day is done is to work with the history of trades

To make it independant from any other activity on the account, the EA should use a unique magicnumber

So on every tick you look into the history whether there is a trade with closetime greater or equal midnight

 

Could be something like this:

bool CheckHistory()
{
int i, odrs;

  odrs=OrdersHistoryTotal();
  for(i=odrs-1;i>=0;i--)
  {
     if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)
     {
        if(OrderSymbol()==Symbol() && OrderMagicNumber()==magicnr)
        {
           //if last trade in history closed today, we are done for today
           if(OrderCloseTime()>=iTime(NULL,PERIOD_D1,0))
              return(true);
           //otherwise we can exit here
           else            
              break;  
        
        }
     }
  }
  return(false);
}

Link to comment
Share on other sites

Ok, added a bool that will stop the ea after the profit is reached for the day , without taking in account balance changes by other ea`s ore manual trades.

enjoy

 

http://www.2shared.com/file/Vo2pbAkG/MartinProfitcutout_v2.html

 

One problem I'm seeing is with the inclusion of the realized profit into the history check:

The EA can open up to MaxPos trades. Even if you get the profit-reached-trigger on the open trades does not necessarily mean that you can lock in the whole profit. So you could end up with 19.88 realized (slippage) and the EA would continue to trade

Link to comment
Share on other sites

One problem I'm seeing is with the inclusion of the realized profit into the history check:

The EA can open up to MaxPos trades. Even if you get the profit-reached-trigger on the open trades does not necessarily mean that you can lock in the whole profit. So you could end up with 19.88 realized (slippage) and the EA would continue to trade

 

the history check is not done on every tick. it is only done after we are actually closing all trades for the day cause we reached our profit target ! .

 

than again , the guy did mention he wants it stoped after reaching profit target for the day . thus 19.88 aint 20 . well not sure what to say . testing it seems to do just fine . i will modify something tough , cause in the way its working now , if while durring the reach of that 20 profit for the day , another ea would make some losses , the equity check wont close anymore the martin trades . so it still needs one mod.

 

 

As always , on II , we start from a small mod and we end up with a huge project. just wait for 3 more pages and you will see. :D

 

funny part is , i bet ja , the guy who asked for the mod, is only using this ea , and does`nt need any other mods. first mod would have been more than enough :d

Edited by MickyMouse
Link to comment
Share on other sites

Thanks Mickeymouse and all the others. Really great of all of you to assist. I do not do any manual trades on this acc and so far have been doing quite well...even $19 is close enough to $20 so thats fine...just dont want it to get to a situation where the tradesrun away with me..this should work fine...I only trade from midnight (GMT+2) so will run tonight and see how it goes...most days would have taken profit by morning

 

Best rgds and thanks to all of you for your contributions

Link to comment
Share on other sites

if he's going to trade demo only, I would agree with the first mod being sufficient

but real money...I don't know

Maybe it's because I'm doing programming as a profession and therefore looking at things a little bit different

I would even go so far that I wouldn't rely on the EA to close the trades but calculate the TP after each new added trade and set it for all open positions

Link to comment
Share on other sites

if he's going to trade demo only, I would agree with the first mod being sufficient

but real money...I don't know

Maybe it's because I'm doing programming as a profession and therefore looking at things a little bit different

I would even go so far that I wouldn't rely on the EA to close the trades but calculate the TP after each new added trade and set it for all open positions

 

 

Mate , no hard feelings ore something , you can do it better , why dont you just do it and that`s it ?

as long as there are ticks coming, and as long as the broker aint a ***** and aint disconnecting every minute ore so , than this fix should work just fine .

As i said before, as you can see, the guy is only using this ea. so as far as im concerned, this fixes will do what he requested. So unless another member asks for another mod to it, i don`t see why we should brag about it ?

 

Cheers and happy Trading!

Link to comment
Share on other sites

Thanks Mickeymouse and all the others. Really great of all of you to assist. I do not do any manual trades on this acc and so far have been doing quite well...even $19 is close enough to $20 so thats fine...just dont want it to get to a situation where the tradesrun away with me..this should work fine...I only trade from midnight (GMT+2) so will run tonight and see how it goes...most days would have taken profit by morning

 

Best rgds and thanks to all of you for your contributions

 

forgot to mention , in the inputs of the ea , last input is called maxdailyprofit

there is where you set your profit target in dollars ore whatever other currency your account is in. as default was set at 20 .

 

Cheers

Link to comment
Share on other sites

ok so in this last mod , profits are calculated according to history and open trades, not according to balance ore equity . thus the ea can be used along any other system without any interference. just make sure the magic numbers don't match . also there are situations when we don't reach the profit in one day and we move on to the next day with floating trades. in this cases, the ea doesn't reset at the beginning of a new day , but waits until all open trades and closed trades until the last reset reach the minimum profit target, and than resets itself.

 

In the back tests works just fine. Still not sure if its fully bullet proof so test and if anything goes wrong, reply back . Test as in demo test not real money tests :D .

i will do some testing myself to make sure its all ok .

 

http://www.2shared.com/file/Xdp_cmwa/MartinProfitcutout_v3.html

 

have fun

 

As far as slippage goes, slippage works both ways . if you`re brokers only knows how to slip in a negative way , i suggest you change the broker rather than trying to start trading again to make up for 20 cents out of 20 dollars. my opinion anyways.

Edited by MickyMouse
Link to comment
Share on other sites

Thanks MickyMouse for all you have done. Am running it now and will see how it does...One last request if ok...I only startthe ea at 00:00 broker time and let it run till profit is taken...Is it possible for you to program in a time feature where if i loaded the ea it would only start trading at specified time? Many thanks...Also backtested and works perfectly!! Thanks so much.
Link to comment
Share on other sites

Hi ,

 

added reset hour value at the end of inputs. made it a whole number, i supose it will suffice. if you need minutes as well, well let me know :D . at the time beeing it recognizez numbers from 0 , 1 , 2 , 3 - 23 .

 

Cheers

 

http://www.2shared.com/file/cKoJDkpN/MartinProfitcutout_v4.html

Link to comment
Share on other sites

  • 1 month later...
Hi MickyMouse, Been using the ea u modified for me and been working well. On certain days(maybe once twice) a month though the currency can break into a strong trend and then drawdown becomes big. Was wondering if you could do the following. Make the ea open buy orders if the price is going up and open sell order if the price is going down. Everything must stay the same as is except for the orders. Currently if price goes up by x pips it is opening sell and vice versa...hope you can help. Many thanks
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...