Experts: Simple Adviser EMA WMA RSI

 

Simple Adviser EMA WMA RSI:

Simple Expert Advisor. In this version RSI and Trailing Stop has been added.

Author: Vladimir Khlystov

 
  1. You must always count down when closing multiple orders and refresh between each. You must always refresh between modifying orders.
       for (int i=0; i<OrdersTotal(); i++)
       {                                               
          if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
          {
             if (OrderSymbol()!=Symbol()||Magic!=OrderMagicNumber()) continue;
             if (OrderType()==OP_BUY && ord=="Buy")
    
       for (int i=OrdersTotal()-1; i>=0; i--) if(
          OrderSelect(i,SELECT_BY_POS,MODE_TRADES)
       && OrderSymbol()      == Symbol()
       && OrderMagicNumber() == Magic!) {
             if (OrderType()==OP_BUY && ord=="Buy")


  2. SL, TP, and slippage, and delta in units pips. But on a 5 digit broker, a pip is not a point.
    TP = Bid - takeprofit*Point
    OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE);
    
    They either all need to be modified when changing brokers, or the EA must internally adjust:
    //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int init() {
        if (Digits == 5 || Digits == 3) {   // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    //...
    TP  = Ask + takeprofit*pips2dbl;
    OrderClose(OrderTicket(),OrderLots(),Bid,3*pips2points,CLR_NONE);
    

    Otherwise well written.
 
WHRoeder:

  1. Otherwise well written.

Thank you for your participation. Always glad to give you the opportunity to comment on my work.
Good luck!
 
great job
 

Demo traded for the past 24-hours. Account grew from #3,000 to $5,500 then blew-up. Sooner or later those losing trades as open positions will gobble up account equity and trigger account stop-out. Great EA IF it can deal more successfully with losing open positions.

 
Hello

Could you translate erros to english

void ShowERROR(int Ticket,double SL,double TP)
{
int err=GetLastError();
switch ( err )
{
case 1: return;
case 2: Alert("Íåò ñâÿçè ñ òîðãîâûì ñåðâåðîì ",Ticket," ",Symbol());return;
case 130: Alert("Error áëèçêèå ñòîïû Ticket ", Ticket," ",Symbol());return;
case 134: Alert("Íåäîñòàòî÷íî äåíåã ", Ticket," ",Symbol());return;
case 146: Alert("Error Ïîäñèñòåìà òîðãîâëè çàíÿòà ", Ticket," ",Symbol());return;
case 129: Alert("Error Íåïðàâèëüíàÿ öåíà ", Ticket," ",Symbol());return;
case 131: Alert("Error Íåïðàâèëüíûé îáúåì ", Ticket," ",Symbol());return;
default: Alert("Error ",err," Ticket ", Ticket," ",Symbol());return;
}
}


and this options.

extern int TrailingStop = 70; //åñëè= 0, òî òðåéëèíã ïî ôðàêòàëàì èëè ñâå÷àì
extern int Tip.Fr.or.Candl = 1; //åñëè= 0, òî òðåéëèíã ïî ôðàêòàëàì
//åñëè= 1, òî òðåéëèíã ïî ñâå÷àì
 
yop289:
Hello

Could you translate erros to english

void ShowERROR(int Ticket,double SL,double TP)
{
int err=GetLastError();
switch ( err )
{
case 1: return;
case 2: Alert("Íåò ñâÿçè ñ òîðãîâûì ñåðâåðîì ",Ticket," ",Symbol());return;
case 130: Alert("Error áëèçêèå ñòîïû Ticket ", Ticket," ",Symbol());return;
case 134: Alert("Íåäîñòàòî÷íî äåíåã ", Ticket," ",Symbol());return;
case 146: Alert("Error Ïîäñèñòåìà òîðãîâëè çàíÿòà ", Ticket," ",Symbol());return;
case 129: Alert("Error Íåïðàâèëüíàÿ öåíà ", Ticket," ",Symbol());return;
case 131: Alert("Error Íåïðàâèëüíûé îáúåì ", Ticket," ",Symbol());return;
default: Alert("Error ",err," Ticket ", Ticket," ",Symbol());return;
}
}


and this options.

extern int TrailingStop = 70; //åñëè= 0, òî òðåéëèíã ïî ôðàêòàëàì èëè ñâå÷àì
extern int Tip.Fr.or.Candl = 1; //åñëè= 0, òî òðåéëèíã ïî ôðàêòàëàì
//åñëè= 1, òî òðåéëèíã ïî ñâå÷àì




case 2: Alert ("No connection with the trading server
case 130: Alert ("Error close foot
case 134: Alert ("Not enough money
case 146: Alert ("Error Subsystem busy trade
case 129: Alert ("Error Invalid price
case 131: Alert ("Error Invalid volume
 
TrailingStop = 70, / / if = 0, then trailing by fractals or candles
Tip.Fr.or.Candl = 1; / / if = 0, then trailing by fractals
/ / If = 1, then trailing by candlelight
 
WHRoeder:
  1. You must always count down when closing multiple orders and refresh between each. You must always refresh between modifying orders.
       for (int i=0; i<OrdersTotal(); i++)
       {                                               
          if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
          {
             if (OrderSymbol()!=Symbol()||Magic!=OrderMagicNumber()) continue;
             if (OrderType()==OP_BUY && ord=="Buy")
    
       for (int i=OrdersTotal()-1; i>=0; i--) if(
          OrderSelect(i,SELECT_BY_POS,MODE_TRADES)
       && OrderSymbol()      == Symbol()
       && OrderMagicNumber() == Magic!) {
             if (OrderType()==OP_BUY && ord=="Buy")


  2. SL, TP, and slippage, and delta in units pips. But on a 5 digit broker, a pip is not a point.
    TP = Bid - takeprofit*Point
    OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE);
    
    They either all need to be modified when changing brokers, or the EA must internally adjust:
    //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int init() {
        if (Digits == 5 || Digits == 3) {   // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    //...
    TP  = Ask + takeprofit*pips2dbl;
    OrderClose(OrderTicket(),OrderLots(),Bid,3*pips2points,CLR_NONE);
    

    Otherwise well written.

Hi

Thankful to the author of the EA. Please give the details, exactly in which step, the above coding has to be inserted in the attached EA.

Thanking you somuch
 
robert76:
Hi
Thankful to the author of the EA. Please give the details, exactly in which step, the above coding has to be inserted in the attached EA.
Thanking you somuch

Passed to complicate the test program? For 5 marks simply to increase the settings Adviser SL and TP by 10 times.

Your feedback can leave here

Good luck!
 
It's obvious to me at least as I watched this EA unfold on an FXDD demo that the brokers (#1) share a an unfair advantage with a supercomputer that dodged almost every red t/p line this EA threw at it and (#2) I think they are using the bulk of OUR OWN MONEY maybe 10 to 1 as a HEDGE against us and (#3) Brokers can and will do rotten stuff like disconnect your setup while you sleep. It happened to me with sob Interbank FX on Black Thursday early AM and I couldn't get back on. While this EA produced seven closed trades, it had the equivalent of fourteen open trades in drawdown. ~ JJ
 

Thanks for this, I've been workin on closing the trades based on some better indicators instead of just static TP and SL values.

Reason: