Experts: RUBBERBANDS_2 EA - page 3

 

i did download two rubberband and i dont see any on list metatrader4 how do that !

 
pagouri:

Your work is greatly appreciated and thank u vvm althaugh I am getting the followng error : RUBBERBANDS_2 EURUSD,M5 : Error opening Buy order :4109...it passes fine through the strategy tester but when applied it gives me that error...is it a setting wrong ?


Thank you for your kind comment. Error 4109 means "Trade not allowed". Maybe your FX dealer does not allow BUY & SELL orders to be placed at a time. Or due to one of other reasons i can not think of.

 
oilmanusc:

i did download two rubberband and i dont see any on list metatrader4 how do that !

If you compiled .mq4 files, while MQL4 client was running, and have .ex4 files under "experts" folder, you need to close MQL4 client and restart it to see them in the list.

 
henrycol69:

Dear friend, let me give my idea. It would be good to close all the negotiations at a loss when the profitloss is a + 10$ or other amount set in the EA. In this way you let go that transaction until il arrives at the result of the stoploss.

Thank you for your fancy idea. I will take it into consideration when writing RUBBERBAN_3.

 
ggekko:

Have you any idea? I think so the main problem is that there is an insoluble antagonism between the two kind of market-behaviour. To make one EA for trending and non-trending market is a really big challenge.

Well. as with the original RUBBERBAND, we would open a BUY and SELL orders initially, take profits (by closing the corresponding order with the other intact) in forwrd direction - this time, repaetedly (on specified "pipstep" basis) as much as possible, and when the trend reverses itself, we would keep the last order or kill it (which is better I don't know right now) and place a new order in this new direction and do the same as the former direction. The baseline is to make profit in any single session, which may sound too ambitious.

 

I would say only use this on the main ranging pairs, not any of the majors or *yen

Adjust pipstep and SessionTP for each pair

 
StJojo:
hulspas:
ggekko:
WILMER:
really good i made a few adjustment and used in a demo account with 5000.00 and made me 1500.00 in just a night

A longer trending period will kill your account.

mayby we should have a version 3 of this with a pipstep for the right direction i mean when the pair is going to trend you have x orders for sell put a buy order in it and close when the price is going down for x levels more profits and a little bit saver for your account

the idea is great for a longer term investment thank you

sorry for my bad english

Well, thank you for all of your comments. I'm writing RUBBERBAND_3 which will also make profits in forward direction (as with the original RUBBERBAND) and withstand big long trends.


thank you i cant't wait this ea have a good potential.!!! great work

look at exp amstell combine somethings of it that is a great ea too.

 
hulspas:

thank you i cant't wait this ea have a good potential.!!! great work

look at exp amstell combine somethings of it that is a great ea too.


I have looked at "exp amstell" and it is indeed very neat !

 
StJojo:
hulspas:

thank you i cant't wait this ea have a good potential.!!! great work

look at exp amstell combine somethings of it that is a great ea too.


I have looked at "exp amstell" and it is indeed very neat !

i have bin busy 2 days to get something of the ground some combine of rubberbands and amstell

im not a coder but the ea is working.....:-)

//+------------------------------------------------------------------+
//|                                                  exp_Amstell.mq4 |
//|                                   Copyright © 2009, Yuriy Tokman |
//|                                            yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Yuriy Tokman"
#property link      "yuriytokman@gmail.com"
//òîðãîâëÿ áåç ñòîï ëîñîâ,ïåðèîä day,ïîêóïàòü ,åñëè öåíà îòêðûòèÿ ïîñëåäíåãî 
//îòêðûòîãî îðäåðà âûøå òåêóùåé öåíû,è çàêðûâàòü îðäåð ïî äîñòèæåíèè 1000 ïóíêòîâ,
//òî æå è ñ ïðîäàæåé.îòêðûâàòü îðäåð sell,åñëè ïîñëåäíèé îòêðûòûé sell íèæå òåêóùåé 
//öåíû. îòêðûâàòü ïîçèöèè ïî öåíàì îòêðûòèÿ
extern double My_Money_Profit_Target=10;     //The amount of money profit at which you want to close ALL open trades.
extern int    Test             = 300;
extern int    Distancebuy         = 500;
extern double Lotsbuy             = 0.02; 
extern int    TakeProfitbuy       = 10000;
extern int    Distancesell         = 500;
extern double Lotssell             = 0.01; 
extern int    TakeProfitsell       = 10000;            // Ðàçìåð òåéêà â ïóíêòàõ
extern bool UseTrailing        = true; //enabling/disabling T-SL
extern int TrailingStopsell        = 500;   //Trailing Stop Loss level
extern int TrailingStopbuy      = 0;   //Trailing Stop Loss level
extern int TrailingStep        = 500;    //Trailing Stop Loss step
extern double    priceAlert;
int Slippage=5;
int i;
extern int    StopLoss         = 50000;
 
  
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  int Magic=0;
  
for(int cnt=0;cnt<OrdersTotal();cnt++)// Ïåðåáèðàåì âñå îðäåðà
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);//îðäåð âûáèðàåòñÿ ñðåäè îòêðûòûõ è îòëîæåííûõ îðäåðîâ
      if( OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)// Ñîâïàäàåò ëè ñèìâîë îðäåðà( Çäåñü ïî íàäîáíîñòè åù¸ ìàãèê ìîæíî ïðîâåðèòü)
        {
         if(OrderType()==OP_BUY)//Îòáèðàåì ïîçèöèþ áàé
           {
            if(Bid-OrderOpenPrice()>TakeProfitbuy*Point || OrderOpenPrice()-Ask>StopLoss*Point)//
              {
               OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Violet); //çàêðûâàåì îðäåð
               return(0); // âûõîäèì
              }//StopLoss
           }
          if(OrderType()==OP_SELL)//Îòáèðàåì ïîçèöèþ ñåëë
           {
            if(OrderOpenPrice()-Ask>TakeProfitsell*Point || Bid-OrderOpenPrice()>StopLoss*Point)//
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Violet); //çàêðûâàåì îðäåð
               return(0); // âûõîäèì
              }
           }
         }
      }
//----
 int buy = 0, sell = 0;
//----
   if(!ExistPositions(NULL,OP_BUY))buy=1;
   else if(PriceOpenLastPos(NULL,OP_BUY)-Ask>Distancebuy*Point)buy=1; 
   
   if(!ExistPositions(NULL,OP_SELL))sell=1;
   else if(Bid-PriceOpenLastPos(NULL,OP_SELL)>Distancesell*Point)sell=1;   
//----
    if(buy==1)
    OrderSend(Symbol(),OP_BUY,Lotsbuy,Ask,3,0,0,"",0,0,Green);
   
    if(sell==1)
    OrderSend(Symbol(),OP_SELL,Lotssell,Bid,3,0,0,"",0,0,Red); 
     
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|  Îïèñàíèå : Âîçâðàùàåò ôëàã ñóùåñòâîâàíèÿ ïîçèöèé                          |
//+----------------------------------------------------------------------------+
//|  Ïàðàìåòðû:                                                                |
//|    sy - íàèìåíîâàíèå èíñòðóìåíòà   (""   - ëþáîé ñèìâîë,                   |
//|                                     NULL - òåêóùèé ñèìâîë)                 |
//|    op - îïåðàöèÿ                   (-1   - ëþáàÿ ïîçèöèÿ)                  |
//|    mn - MagicNumber                (-1   - ëþáîé ìàãèê)                    |
//|    ot - âðåìÿ îòêðûòèÿ             ( 0   - ëþáîå âðåìÿ îòêðûòèÿ)           |
//+----------------------------------------------------------------------------+
bool ExistPositions(string sy="", int op=-1, int mn=-1, datetime ot=0) {
  int i, k=OrdersTotal();
  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (ot<=OrderOpenTime()) return(True);
            }
          }
        }
      }
    }
  }
  return(False);
}
//+----------------------------------------------------------------------------+
//|  Âåðñèÿ   : 19.02.2008                                                     |
//|  Îïèñàíèå : Âîçâðàùàåò öåíó îòêðûòèÿ ïîñëåäíåé îòêðûòîé ïîçèöèé.           |
//+----------------------------------------------------------------------------+
//|  Ïàðàìåòðû:                                                                |
//|    sy - íàèìåíîâàíèå èíñòðóìåíòà   (""   - ëþáîé ñèìâîë,                   |
//|                                     NULL - òåêóùèé ñèìâîë)                 |
//|    op - îïåðàöèÿ                   (-1   - ëþáàÿ ïîçèöèÿ)                  |
//|    mn - MagicNumber                (-1   - ëþáîé ìàãèê)                    |
//+----------------------------------------------------------------------------+
double PriceOpenLastPos(string sy="", int op=-1, int mn=-1) {
  datetime t;
  double   r=0;
  int      i, k=OrdersTotal();
  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderOpenTime()) {
                t=OrderOpenTime();
                r=OrderOpenPrice();
              }
            }
          }
        }
      }
    }
  }
   
//+-------------------------------------------------------------------------------------------------+ 
//|                                      trail of open orders                                       |
if (UseTrailing)
{ 
  for (int trall=0; trall<OrdersTotal(); trall++) {
    if (!(OrderSelect(trall, SELECT_BY_POS, MODE_TRADES))) continue;
    if (OrderSymbol() != Symbol()) continue;       
 
    if (OrderType() == OP_BUY ) {
      if (Bid-OrderOpenPrice() > TrailingStopbuy*Point) {
        if (OrderStopLoss() < Bid-(TrailingStopbuy+TrailingStep-1)*Point || OrderStopLoss() == 0) {
          OrderModify(OrderTicket(), OrderOpenPrice(), Bid-TrailingStopbuy*Point, OrderTakeProfit(), 0, Blue);
       }
      }
    }
 
    if (OrderType() == OP_SELL) {
     if (OrderOpenPrice()-Ask > TrailingStopsell*Point) {
        if (OrderStopLoss() > Ask+(TrailingStopsell+TrailingStep-1)*Point || OrderStopLoss() == 0) {
          OrderModify(OrderTicket(), OrderOpenPrice(), Ask+TrailingStopsell*Point, OrderTakeProfit(), 0, Blue);
        }
     }
    }
  }
 }
//|                                      trail of open orders                                       |
//+-------------------------------------------------------------------------------------------------+
if (AccountProfit()>= My_Money_Profit_Target)
{
    for(i=OrdersTotal()-1;i>=0;i--)
       {
       OrderSelect(i, SELECT_BY_POS);
       int type   = OrderType();
               
       bool result = false;
              
       switch(type)
          {
          //Close opened long positions
          case OP_BUY  : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slippage,Pink);
                         break;
               
          //Close opened short positions
          case OP_SELL : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,Pink);
                          
          }
          
       if(result == false)
          {
            Sleep(3000);
          }  
       }
      Print ("Account Profit Reached. All Open Trades Have Been Closed");
      return(0);
   }  
   
   Comment("Balance: ",AccountBalance(),", Account Equity: ",AccountEquity(),", Account Profit: ",AccountProfit(),
           "\nMy Account Profit Target: ",My_Money_Profit_Target);
   
  return(r);
}
  




 

Beginning .. Thank you to share your idea

I have an idea for the development of expert advisor ..

Is it possible to add these properties

1 - pip difference between the sale and buy

2 - continued to take profit in one direction for any of the buy or sale

I apologized for not being able to speak in English well :)

almeshal78@hotmail.com

Reason: