Page 31 of 38

Re: Simple Expert Advisors (EA's) for MT4

Posted: Fri Aug 13, 2021 5:16 am
by Cladi39
Hello guys . I need an EA for forex and indices that work with a custom indicator ( arrow with 2 buffers) SL/TP and hours filter. Any help`will be apreciated.

Re: Simple Expert Advisors (EA's) for MT4

Posted: Sun Aug 15, 2021 6:29 pm
by dokopy
I only use this EA with one pair. Restarting the profile closes all positions. Is there anything you can do about it? EA gets out of a larger drawdown, but premature closure is very undesirable.

Re: Simple Expert Advisors (EA's) for MT4

Posted: Sat Aug 21, 2021 3:44 pm
by srivegunta992
Hello
Can anybody add an alert to the currency strength lines indicator,i want alerts when the currency lines crossover and alert when a currency line crosses zero line upwards and downwards,
Is it possible to make an EA out of this indicator
Thanks

Horizontal Line EA

Posted: Sun Aug 29, 2021 8:03 pm
by KVSMSTF_19
Hi mrtools
Do you have an expert advisor you can recommend
Thanks

Re: Simple Expert Advisors (EA's) for MT4

Posted: Thu Sep 16, 2021 12:54 am
by Knight
A simple EA with.
- Time filter
- Daily drawdown protection (by equity)
- Max. Drawdown protection (by equity)
Would be really cool, especially for prop firms.

By the way, is there a thread for prop firm traders, strategies and enthusiasts?

It seems to be the current rave and also the best support for traders these days.

Re: Simple Expert Advisors (EA's) for MT4

Posted: Mon Nov 01, 2021 4:45 am
by nickbyniel1541
Good afternoon guys - plz see the above gif file. This is a simple EA I'm working on that places a pending order when price gets back into the BBands. If possible, can some explain to me what I am doing wrong. I want the pending trade placed without the SL and TP. Only when the trade becomes active do I want the trade to be modified and the stops added. mrtools or anyone else can you plz point me in the right direction....thanks very much in advance.

Here is the code for the pending function

Code: Select all

void TradeStart(int orderType){

   double candleHigh1 = iHigh(Symbol(), Period(), 1);
   double candleLow1 = iLow(Symbol(), Period(), 1);
   datetime candleExperation = iTime(Symbol(), Period(), 0)+PeriodSeconds() - 1;

   int i = 0;
   //---determine if we are buying or selling 
   double price = candleLow1 - 3*pips;
   double sl = 0, tp = 0;
   if(orderType == OP_BUYSTOP) price = candleHigh1 + 3*pips;
   
   int err = 0;
   int  TicketNumber = OrderSend(Symbol(),orderType,LotSize,price,Slippage,0,0," ",
                       MagicNumber,0,clrGreen);
   if(TicketNumber == -1)
   {
      err = GetLastError();
      Print("Could not place the order due to error ",err," ",ErrorDescription(err));
      if(err == ERR_TRADE_NOT_ALLOWED)Alert("YOU NEED TO ENABLE YOUR AUTOTRADING BUTTON!");
   }
   else//If we are able to select an order
   {   
      if(!OrderSelect(TicketNumber,SELECT_BY_TICKET))
      {
      err = GetLastError();
      Print("Could not select the order due to error ",err," ",ErrorDescription(err));
      }
      else//If we are able to select an order
      {
         double priceOpen = OrderOpenPrice();
         sl = priceOpen + (Stoploss*pips);
         tp = priceOpen - (Takeprofit*pips);
         if(OrderType() == OP_BUYSTOP){
            sl = priceOpen - (Stoploss*pips);
            tp = priceOpen + (Takeprofit*pips);   
         }
         if(!OrderModify(TicketNumber, price, sl, tp, 0, clrGreen))
         {
            err = GetLastError();
            Print("Could not modify the order due to error ",err," ",ErrorDescription(err));
         }         
      }
   }         
}

Re: Simple Expert Advisors (EA's) for MT4

Posted: Mon Nov 01, 2021 7:15 am
by mrtools
nickbyniel1541 wrote: Mon Nov 01, 2021 4:45 am
Image


Good afternoon guys - plz see the above gif file. This is a simple EA I'm working on that places a pending order when price gets back into the BBands. If possible, can some explain to me what I am doing wrong. I want the pending trade placed without the SL and TP. Only when the trade becomes active do I want the trade to be modified and the stops added. mrtools or anyone else can you plz point me in the right direction....thanks very much in advance.

Here is the code for the pending function

Code: Select all

void TradeStart(int orderType){

   double candleHigh1 = iHigh(Symbol(), Period(), 1);
   double candleLow1 = iLow(Symbol(), Period(), 1);
   datetime candleExperation = iTime(Symbol(), Period(), 0)+PeriodSeconds() - 1;

   int i = 0;
   //---determine if we are buying or selling 
   double price = candleLow1 - 3*pips;
   double sl = 0, tp = 0;
   if(orderType == OP_BUYSTOP) price = candleHigh1 + 3*pips;
   
   int err = 0;
   int  TicketNumber = OrderSend(Symbol(),orderType,LotSize,price,Slippage,0,0," ",
                       MagicNumber,0,clrGreen);
   if(TicketNumber == -1)
   {
      err = GetLastError();
      Print("Could not place the order due to error ",err," ",ErrorDescription(err));
      if(err == ERR_TRADE_NOT_ALLOWED)Alert("YOU NEED TO ENABLE YOUR AUTOTRADING BUTTON!");
   }
   else//If we are able to select an order
   {   
      if(!OrderSelect(TicketNumber,SELECT_BY_TICKET))
      {
      err = GetLastError();
      Print("Could not select the order due to error ",err," ",ErrorDescription(err));
      }
      else//If we are able to select an order
      {
         double priceOpen = OrderOpenPrice();
         sl = priceOpen + (Stoploss*pips);
         tp = priceOpen - (Takeprofit*pips);
         if(OrderType() == OP_BUYSTOP){
            sl = priceOpen - (Stoploss*pips);
            tp = priceOpen + (Takeprofit*pips);   
         }
         if(!OrderModify(TicketNumber, price, sl, tp, 0, clrGreen))
         {
            err = GetLastError();
            Print("Could not modify the order due to error ",err," ",ErrorDescription(err));
         }         
      }
   }         
}
Sorry not very skilled in pending order type EA's.

Re: Simple Expert Advisors (EA's) for MT4

Posted: Mon Nov 01, 2021 12:52 pm
by nickbyniel1541
mrtools wrote: Mon Nov 01, 2021 7:15 am Sorry not very skilled in pending order type EA's.
Always glad for you help mrtools. I'm still at it. I got the trade to be taken without the stop, however
when I use orderselect to try to modify it and add the SL and TP nothing happen.

The trade opens as normal in the strategy tester however in the journal the type says "sell" not "stopSell" anymore. So I not sure if it a different order or for that matter calling the right order.
Thanks thought - I'll keep at it till something clicks..lol

Re: Simple Expert Advisors (EA's) for MT4

Posted: Thu Nov 25, 2021 2:06 am
by davy
Dear MrTools and Mladen,

Can you make simple ea using Averages - mtf - alters 8.8 indicator just by going buy or sell as it change color?
Thank you.

Re: Simple Expert Advisors (EA's) for MT4

Posted: Thu Nov 25, 2021 10:17 pm
by davy
davy wrote: Thu Nov 25, 2021 2:06 am Dear MrTools and Mladen,

Can you make simple ea using Averages - mtf - alters 8.8 indicator just by going buy or sell as it change color?
Thank you.
Perhaps you can help me how to call the buffer.
I am learning.
Thank you.