Half automatic EA?
6 replies
Conmariin
6 years ago #231029
Hi! 🙂
Is it possible to build an half automatic EA? I mean opening the trade immediately or by stop-order manually. But the rest like SL, TS and so on will be managed by the EA after opening.
I tried, see attachment, but after I opened a trade manually it opens another but without adding SL and so on.
SL is 2*ATR(14) and TP is double 2*ATR(14). After reaching the TP it should close Trade partially.
Can anyone help me out?
Thanks! 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
tomas262
6 years ago #231039
Hello,
here is an example on a semi-auto trading system on our blog https://strategyquant.com/article/simple-support-resistance-trading-system-tutorial-for-ea-wizard
Why don’t you set the SL with the buy/sell order? You can start with a big value and modify as trade develops
Conmariin
6 years ago #231050
Thanks for your answer, but I think that’s not directly what I want. In this S/R example the order is opened when price hits Support or Ressistance. But what I want is: User is opening an order manually (buy or sell). He’s allowed only open one per direction per chart/symbol.
The semiautomatic EA activates by “seeing” an order is opened an overtake control. (Adding SL, PT, TS, etc.) and in my case after reaching the PT Goal close order partially. Is that possible?
Thanks! 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
tomas262
6 years ago #231069
Hello,
this cannot be done in EA Wizard directly. You would need to use additional MQL4 code to manage SL, PT, TS. I can try to create a function that places SL & PT for manually placed trades
Conmariin
6 years ago #231073
Hi Tomas,
ah okay. I understand. That would be nice. 🙂
Thank you! 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
tomas262
6 years ago #232710
Hello
I have attached an example on how to use EA to add SL + PT to a manual order. Once a long order is opened without SL & PT EA automatically add SL + PT of predefined size. See the file attached.
Also custom code must be added to CustomFunctions.mq4
void setSLPT(int orderMagicNumber, int slpips, int ptpips) {
for(int op=0; op<OrdersTotal();op++) {
if(OrderSelect(op,SELECT_BY_POS,MODE_TRADES)==true && OrderMagicNumber()==orderMagicNumber) {
double slprice = NormalizeDouble(OrderOpenPrice()-10*Point*slpips,Digits);
double ptprice = NormalizeDouble(OrderOpenPrice()+10*Point*ptpips,Digits);
OrderModify(OrderTicket(),OrderOpenPrice(),slprice,ptprice,0,Blue);
}
}
}
Conmariin
6 years ago #232716
Thank you so much Tomas! 🙂
That will help me enormously!
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
Viewing 6 replies - 1 through 6 (of 6 total)