Any programer? i need a EA

i need a simple EA to manage my trades after they are open…
i want something very expecific that i haven´t found anywhere.

i would like to have a trendline draw by hand but that after being placed works as a SL…

if someone can program something like that i´ll be very apprechiate

Rui, I think I remember seeing something like that already written. on another website. I’ll try to find it again. I think it was on mql4.com

Look at this. Maybe this is what you want?
Open and Close positions using the lines - MQL4 Code Base

TalonD you´re the man:D

that´s exactly what i need… thank you very much…

You’re welcome! I was thinking of using that one myself on the londonbreak1

Just stumbled across this thread, this seems like a very neat tool. Time to demo it and see if I can incorporate it into some of my trading.

I’m pretty sure this is all you need

OrderSelect(1, SELECT_BY_POS) //this is to select the order you want to modify

SL = ObjectGet(“SL”, OBJPROP_PRICE1)
OrderModify(OrderTicket(),OrderOpenPrice(),SL,OrderTakeProfit(),0,Blue);

just name the trendline you use for your stop - SL

Sweet! I didn’t know MQL4 can do that! Maybe I should look into MT4 more now…

Yes, you can just about do anything you want with MT4 it’s really flexible.

hi purplepatchforex. i don´t understand what to do with this… cna you explain please.

This is something like what you want to achieve, create a new expert advisor in Metatrader and paste this code in.

//+------------------------------------------------------------------+
//|                                                     stoploss.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   OrderSelect(1, SELECT_BY_POS) //this is to select the order you want to modify

SL = ObjectGet("SL", OBJPROP_PRICE1)
OrderModify(OrderTicket(),OrderOpenPrice(),SL,OrderTakeProfit(),0,Blue);
//----
   return(0);
  }

I’m not going down the route of actually doing the whole the thing and testing and making sure it all works etc etc etc. for 2 reasons mainly, I just can’t be bothered any more, and also if you can put a little effort in to understand how the scripts work, you’ll be able to do a lot yourself.

Have a go, get back to me if you want to know more, I’m happy to help.

i had copy past into mt editor but got no luck… the EA don´t do anything:(

OK, sorry if these questions may seem stupid, but I need to know what you’ve done.

Did you Compile the EA?
Have you Set expert advisors ON?
Have you changed the Name/Description of the trendline to SL?

yes… but the EA don´t even go to the chart

I had a quick look at the code in Metaeditor, it won’t compile as is, there’s some things missing, I only posted it up to show you it could be done see,

anyways it’s more like this :-

OrderSelect(1, SELECT_BY_POS); //this is to select the order  to modify


double SL = ObjectGet("SL", OBJPROP_PRICE1); 

//this shows the stop loss price at the top left of your chart
Comment( SL);

OrderModify(OrderTicket(),OrderOpenPrice(),SL,OrderTakeProfit(),0,Blue);

The above code works as is, but to actually set the stop loss I think you will need to work out the stop loss in pips - so you’ll need something like SL=Ask-SL*Point, I’m pretty sure that calculation is on the mql4.com site, stick that in before the line OrderModify and you should be good to go.

Remember to compile and check if there are errors at the bottom of the Metaeditor.