Page 4 of 38

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

Posted: Mon Feb 20, 2017 7:09 am
by ionic
Hello dear friends;

If I ask, can a friend write an ea for this indicator at mt5?
If I know I'm writing it, but I do not understand the code.

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

Posted: Wed Feb 22, 2017 3:14 am
by Zacaka
hi guys,

if there EA or indicator samples like my trend magic please share here

got headache already

thanks

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

Posted: Wed Feb 22, 2017 3:35 am
by mntiwana
Zacaka wrote:hi guys,

if there EA or indicator samples like my trend magic please share here

got headache already

thanks
Hi Zacaka
As per my poor knowledge trend magic is same to old super trend (cci-atr),use some newest super trend indicator there are so many versions with a lot of options ad flexibility and form your EA or search for some already made ea based on super trend but experts can better guide you.

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

Posted: Wed Feb 22, 2017 4:09 am
by Zacaka
Hi Mntiwana,

thanks... ill try to find sample again....

but super trend indicator is different even their base use cci and atr.

ill look n check again...

btw, if experts here can guide me more better

u r expert too mntiwana

thx again

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

Posted: Wed Feb 22, 2017 4:02 pm
by Zacaka
Hi all...

I found RSI Divergence indicator and I would like to use it...

But how to call the arrow buffer? when arrow up and down? coz the arrow not in main chart

1 ea not finished want to try something else lol

at least I tried guys :)

Thanks

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

Posted: Sun Feb 26, 2017 11:30 am
by Zacaka
Hi guys,

any example ea for averaging and close partial lots?
but the simple one.... coz I got a few but with a lot of code
u know that im not a good programmer lol
or help me to add averaging system in above ea "simple stepEA"

thanks

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

Posted: Sun Feb 26, 2017 5:28 pm
by mladen
Zacaka wrote:Hi all...

I found RSI Divergence indicator and I would like to use it...

But how to call the arrow buffer? when arrow up and down? coz the arrow not in main chart

1 ea not finished want to try something else lol

at least I tried guys

Thanks
Use calls to buffers 0 and 1 for that

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

Posted: Sun Feb 26, 2017 7:59 pm
by Zacaka
mladen wrote:Use calls to buffers 0 and 1 for that
Thanks Mladen... Ive already got that from you, master

Code: Select all

void GoMartingale()
{
         int      iCount      =  0;
         double   LastOP      =  0;
         double   LastLots    =  0;
         bool     LastIsBuy   =  FALSE;
         int      iTotalBuy   =  0;
         int      iTotalSell  =  0;
         int      Spread=0;
   
         Spread= MarketInfo(Symbol(), MODE_SPREAD);
         
         for(iCount=0;iCount<OrdersTotal();iCount++)
         {
                    
           OrderSelect(iCount,SELECT_BY_POS,MODE_TRADES);
           
           if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber)
           {
               if(LastOP==0) {LastOP=OrderOpenPrice();}
               if(LastOP>OrderOpenPrice()) {LastOP=OrderOpenPrice();}
               if(LastLots<OrderLots()) {LastLots=OrderLots();}
               LastIsBuy=TRUE;
               iTotalBuy++;
               
               if(iTotalBuy==MaxTrade) {return(0);}
           }
           if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber)
           {
               if(LastOP==0) {LastOP=OrderOpenPrice();}
               if(LastOP<OrderOpenPrice()) {LastOP=OrderOpenPrice();}         
               if(LastLots<OrderLots()) {LastLots=OrderLots();}
               LastIsBuy=FALSE;
               iTotalSell++;
               
               
               if(iTotalBuy==MaxTrade) {return(0);}
           }
         
         }      
         
         
         if(LastIsBuy)
         {
            if(Bid<=LastOP-(Spread*SetPoint)-(PipStep*SetPoint))
            {
               OrderSend(Symbol(), OP_BUY, Multiply*LastLots, Ask, Slippage, 0, Ask+TakeProfit*SetPoint, EAComment, EAMagicNumber);   
               ModifyTP();
               LastIsBuy=FALSE;
               return(0);
            }
         }
         
         else if(!LastIsBuy)
         {
            if(Ask>=LastOP+(Spread*SetPoint)+(PipStep*SetPoint))
            {
               OrderSend(Symbol(), OP_SELL, Multiply*LastLots, Bid, Slippage, 0, Bid-TakeProfit*SetPoint, EAComment, EAMagicNumber);           
               ModifyTP();
               return(0);
            }
         }
}
void ModifyTP()
{
   int      iCount=0;
   double   NewTP=0;
        
         for(iCount=0;iCount<OrdersTotal();iCount++)
         {
           
           OrderSelect(iCount,SELECT_BY_POS,MODE_TRADES);
       
           if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber)
           {
               if(NewTP==0) {NewTP=OrderTakeProfit();}
               if(NewTP>OrderTakeProfit()) {NewTP=OrderTakeProfit();}
               
           }
           
           if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber)
           {
               if(NewTP==0) {NewTP=OrderTakeProfit();}
               if(NewTP<OrderTakeProfit()) {NewTP=OrderTakeProfit();}         
           }
                     
         }
         for(iCount=0;iCount<OrdersTotal();iCount++)
         {
           
           OrderSelect(iCount,SELECT_BY_POS,MODE_TRADES);
       
           if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber)
           {
               OrderModify(OrderTicket(), OrderLots(), 0, NewTP, 0);
           }
           
           if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber)
           {
               OrderModify(OrderTicket(), OrderLots(), 0, NewTP, 0);
           }             
         
         }        
}
Can u help me to add stoploss for that script? If I want only 2 level martingale, then if hit the stoploss it will be all close (same magic number) or open hedging with same lot...
btw, if open hedging... can the new open position make a new magicnumber after hedging or must be close the ea and re-start ea so they will create with new magicnumber?

Thanks

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

Posted: Sun Feb 26, 2017 9:06 pm
by mladen
Zacaka wrote:
Thanks Mladen... Ive already got that from you, master

Code: Select all

 void GoMartingale() { int iCount = 0; double LastOP = 0; double LastLots = 0; bool LastIsBuy = FALSE; int iTotalBuy = 0; int iTotalSell = 0; int Spread=0; Spread= MarketInfo(Symbol(), MODE_SPREAD); for(iCount=0;iCount<OrdersTotal();iCount++) { OrderSelect(iCount,SELECT_BY_POS,MODE_TRADES); if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber) { if(LastOP==0) {LastOP=OrderOpenPrice();} if(LastOP>OrderOpenPrice()) {LastOP=OrderOpenPrice();} if(LastLots<OrderLots()) {LastLots=OrderLots();} LastIsBuy=TRUE; iTotalBuy++; if(iTotalBuy==MaxTrade) {return(0);} } if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber) { if(LastOP==0) {LastOP=OrderOpenPrice();} if(LastOP<OrderOpenPrice()) {LastOP=OrderOpenPrice();} if(LastLots<OrderLots()) {LastLots=OrderLots();} LastIsBuy=FALSE; iTotalSell++; if(iTotalBuy==MaxTrade) {return(0);} } } if(LastIsBuy) { if(Bid<=LastOP-(Spread*SetPoint)-(PipStep*SetPoint)) { OrderSend(Symbol(), OP_BUY, Multiply*LastLots, Ask, Slippage, 0, Ask+TakeProfit*SetPoint, EAComment, EAMagicNumber); ModifyTP(); LastIsBuy=FALSE; return(0); } } else if(!LastIsBuy) { if(Ask>=LastOP+(Spread*SetPoint)+(PipStep*SetPoint)) { OrderSend(Symbol(), OP_SELL, Multiply*LastLots, Bid, Slippage, 0, Bid-TakeProfit*SetPoint, EAComment, EAMagicNumber); ModifyTP(); return(0); } } } void ModifyTP() { int iCount=0; double NewTP=0; for(iCount=0;iCount<OrdersTotal();iCount++) { OrderSelect(iCount,SELECT_BY_POS,MODE_TRADES); if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber) { if(NewTP==0) {NewTP=OrderTakeProfit();} if(NewTP>OrderTakeProfit()) {NewTP=OrderTakeProfit();} } if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber) { if(NewTP==0) {NewTP=OrderTakeProfit();} if(NewTP<OrderTakeProfit()) {NewTP=OrderTakeProfit();} } } for(iCount=0;iCount<OrdersTotal();iCount++) { OrderSelect(iCount,SELECT_BY_POS,MODE_TRADES); if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber) { OrderModify(OrderTicket(), OrderLots(), 0, NewTP, 0); } if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==EAMagicNumber) { OrderModify(OrderTicket(), OrderLots(), 0, NewTP, 0); } } } 
Can u help me to add stoploss for that script? If I want only 2 level martingale, then if hit the stoploss it will be all close (same magic number) or open hedging with same lot...
btw, if open hedging... can the new open position make a new magicnumber after hedging or must be close the ea and re-start ea so they will create with new magicnumber?

Thanks
With  martingale in general you close all the orders with the same magic number and then start a new set with whatever magic number - it can be the same. No need for a new magic number

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

Posted: Sun Feb 26, 2017 9:50 pm
by Zacaka
mladen wrote:With  martingale in general you close all the orders with the same magic number and then start a new set with whatever magic number - it can be the same. No need for a new magic number
ok.. thx..

This what I got this few weeks, open position with averaging
Last target to add stop loss and partial close the position when profit...
If u have time can u help me

tq tq tq