You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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
Hello there. We can surely add those properties and I simply encourage you to modify RUBBERBANDS as you wish and publish it in this community.
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
Hello there. We can surely add those properties and I simply encourage you to modify RUBBERBANDS as you wish and publish it in this community.
StJojo wrote:
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
Hello there. We can surely add those properties and I simply encourage you to modify RUBBERBANDS as you wish and publish it in this community.
On this page you can see the following results
Low risk
Now we need only to amendments that I have mentioned to you
After development will be the best expert in this year :)
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
Hello there. We can surely add those properties and I simply encourage you to modify RUBBERBANDS as you wish and publish it in this community.
On this page you can see the following results
Now we need only to amendments that I have mentioned to you
After development will be the best expert in this year :)
Well, I'm very much flattered. Thank you for your nice graphs. I'm just wondering why you don't publish your amended code. It's not me but you who made it!
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
Hello there. We can surely add those properties and I simply encourage you to modify RUBBERBANDS as you wish and publish it in this community.
On this page you can see the following results
Now we need only to amendments that I have mentioned to you
After development will be the best expert in this year :)
Well, I'm very much flattered. Thank you for your nice graphs. I'm just wondering why you don't publish your amended code. It's not me but you who made it!
Actually .. Did not finish to add the points that I mentioned to you
We are still trying with my friend to modify these points
I hope you help me with reported :)
This is the code : Rubber_Band_v.3.3.mq4
//+------------------------------------------------------------------+
//| Rubber_Band_v.3.mq4 |
//+------------------------------------------------------------------+
/*
This EA works in any timeframe (timeframe is irrelavant) for any
currency pair, including gold and silver. Preferred currency pairs are
four major pairs: EUR/USD, GBP/USD,USD/JPY, and USD/CHF.
Its logic, again, is based on the fact that any price movement may
accompany rebound and the maxim of "Sell high, buy low".
It opens orders in both directions (BUY & SELL) at a time initially,
then opens an additional SELL order everytime the price goes up by m
ultiples of "pipstep" above the initial SELL order, and opens an
additional BUY order everytime the price goes down by multiples of
"pipstep" below the initial BUY order.
It closes all the session outstanding orders when the specified profit
"Dollar_Equity_Profit_Take" (in dollars) is reached, which functions
as TAKEPROFIT, or, if set so ("Use_Equity_Loss_Cut"==true), when the
specified loss "Dollar_Equity_Loss_Cut" (in dollars) is reached, which
functions as STOPLOSS. The opening of the initilal orders through the
closure of all outstanding orders constitutes one "session". The external
variable "Max_Trades" limits the number of orders per session. To avoid
big drawdowns, smaller "Dollar_Equity_Loss_Cut" may help.
*/
#property copyright "Free"
#property link "For free help contact: shihab_shihabi@yahoo.com"
//-----------------------------
extern int Magic_Number_Buy = 111111;
extern int Magic_Number_Sell= 222222;
//----------------------
extern bool Progression_Allowed=true;//chose true to allow avreging down while doubling
//-----------------------------
extern double Initial_Lots=0.01;
extern double Lots_Multiply_Factor=2;//to multiply by last order lot
//----------------------
extern int Max_Trades= 30;//maximum number of orders allowed in one session
extern int Pip_Step = 250; //pip distance to place additional BUY or SELL orders
//----------------------------------------
extern bool Use_Equity_Profit_Take =true;//don't change this. keepm it true
extern double Dollar_Equity_Profit_Take =10000;//profit in dollars per lot to close all outstanding orders
//-----------------------------
extern bool Use_Equity_Loss_Cut = false;//
extern double Dollar_Equity_Loss_Cut = 57400;//loss in dollars per lot to close all outstanding orders
//-----------------------------
extern bool Time_Control = false;
extern string Start_Time = "08:00";
extern string End_Time = "16:00";
//-----------------------------
extern bool Act_Now = false; //if true, opens orders immediately (do now)
extern bool Stop_Now = false;//if true, stops this EA
extern bool Close_Now = false;//if true, closes all outstanding orders
//-----------------------------
/*
The following three external variables are for restarting this EA after,
say, the weekend, when there are outstanding orders. "In_Max_Price_Level" and "In_Min_Price_Level"
are displayed as "Max" and "Min" on the chart.
*/
extern bool Use_In_Values = false; // set to true on restart
extern double In_Max_Price_Level = 0; // set former max on restart
extern double In_Min_Price_Level = 0; // set former min on restart
//------- global var's -----------------
double Max_Global_Price_Level;
double Min_Global_Price_Level;
bool Close_All_Global;
bool Buy_Now_Global;
bool Sell_Now_Global;
//--------------------------------
double Poin; //to fix the 6 Digit Forex Quotes issue for MetaTrader Expert Advisors
string EA_Name = "Rubber_Band";
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
if (Use_In_Values==true)
{
Max_Global_Price_Level=In_Max_Price_Level;
Min_Global_Price_Level=In_Min_Price_Level;
}
else
{
Max_Global_Price_Level=Ask;
Min_Global_Price_Level=Ask;
}
Close_All_Global=Close_Now;
Buy_Now_Global=Act_Now;//(do now)
Sell_Now_Global=Act_Now;//(do now)
if (Point == 0.00001) Poin = 0.0001; //6 digits
else if (Point == 0.001) Poin = 0.01; //3 digits (for Yen based pairs)
else Poin = Point; //Normal for 5 & 3 Digit Forex Quotes
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//+------------------------------------------------------------------+
//| checking trade contexts |
//+------------------------------------------------------------------+
int TradeAllow = Is_Trade_Allowed();
if(TradeAllow < 0)
{
return(-1);
}
if(TradeAllow == 0)
{
RefreshRates();
}
//-----------------------------
int cnt, ticket, total;
bool Close_Now;//, buynow, sellnow
// STOP NOW?
if (Stop_Now==true)
{
Comment_Stopped();
return(0);
}
//Comment_Null();
total=Count_All();
// CLOSE NOW?
// if true, close one by one
if (Close_All_Global==true && total>0)
{
Close_One_By_One();
return(0);
}
if (Close_All_Global==true && total==0)
{
Close_All_Global=false;
Max_Global_Price_Level=Ask;
Min_Global_Price_Level=Ask;
Buy_Now_Global=false;
Sell_Now_Global=false;
}
// check free margin
//if(AccountFreeMargin()<(1000*Get_Buy_Lots()) || AccountFreeMargin()<(1000*Get_Sell_Lots()))
//{
//Print("We have no money. Free Margin = ", AccountFreeMargin());
//return(0);
//}
if((Time_Control==true && CurTime()>=StrToTime(Start_Time)
&& CurTime()>=StrToTime(Start_Time))
|| Time_Control==false)
{
// BUY NOW?
if (Buy_Now_Global==true)
{
ticket=OrderSend(Symbol(),OP_BUY,Initial_Lots,Ask,3,0,0,EA_Name,Magic_Number_Buy,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
if(OrderMagicNumber() == Magic_Number_Buy)
Print("Buy order opened : ",OrderOpenPrice());
}
else
{
Print("Error opening Buy order : ",GetLastError());
return(-1);
}
Buy_Now_Global=false;
return(0);
}
// SELL NOW?
if (Sell_Now_Global==true)
{
ticket=OrderSend(Symbol(),OP_SELL,Initial_Lots,Bid,3,0,0,EA_Name,Magic_Number_Sell,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
if(OrderMagicNumber() == Magic_Number_Sell)
Print("Sell order opened : ",OrderOpenPrice());
}
else
{
Print("Error opening Sell order : ",GetLastError());
return(-1);
}
Sell_Now_Global=false;
return(0);
}
}
// new order from 0 orders
if (total==0 && Seconds()==0)
{
Buy_Now_Global=true;
Sell_Now_Global=true;
return(0);
}
//-------------------------------------------
// counter if you will
if (total>0)
{
// what's the profit made
double My_Profit=0;
int xtotal=OrdersTotal();
for(cnt=0;cnt<xtotal;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
if(OrderMagicNumber() == Magic_Number_Buy || OrderMagicNumber() == Magic_Number_Sell)
{
My_Profit+=OrderProfit();
} //-if
} //-for
Comment_PL("My_Profit",My_Profit,total);
// close all trades for profit made?
if (Use_Equity_Profit_Take ==true && My_Profit>=Dollar_Equity_Profit_Take *Initial_Lots)//Lots
{
Close_All_Global=true;
}
// close all trades for loss cut?
if (Use_Equity_Loss_Cut==true && My_Profit<=(-1)*Dollar_Equity_Loss_Cut*Initial_Lots)//Lots
{
Close_All_Global=true;
}
if (total>=Max_Trades)//maxcount
{
return(0);
}
// do we buy or sell now?
//Buy
if (Ask<=Min_Global_Price_Level-Pip_Step*Poin)
{
Min_Global_Price_Level=Ask;
ticket=OrderSend(Symbol(),OP_BUY,Get_Buy_Lots(),Ask,3,0,0,EA_Name,Magic_Number_Buy,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
if(OrderMagicNumber() == Magic_Number_Buy)
Print("Buy order opened : ",OrderOpenPrice());
}
else
{
Print("Error opening Buy order : ",GetLastError());
return(-1);
}
return(0);
}
//---------------------------
//Sell
if (Ask>=Max_Global_Price_Level+Pip_Step*Poin)
{
Max_Global_Price_Level=Ask;
ticket=OrderSend(Symbol(),OP_SELL,Get_Sell_Lots(),Bid,3,0,0,EA_Name,Magic_Number_Sell,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
if(OrderMagicNumber() == Magic_Number_Sell)
Print("Sell order opened : ",OrderOpenPrice());
}
else
{
Print("Error opening Sell order : ",GetLastError());
return(-1);
}
return(0);
}
//-------------------------------
} // if total
return(0);//end of start function
} //-start
//+------------------------------------------------------------------+
//| checking trade contexts |
//+------------------------------------------------------------------+
int Is_Trade_Allowed(int MaxWaiting_sec = 30)
{
if(!IsTradeAllowed())
{
int StartWaitingTime = GetTickCount();
Print("Trade context is busy! Wait until it is free...");
while(true)
{
if(IsStopped())
{
Print("The expert was terminated by the user!");
return(-1);
}
if(GetTickCount() - StartWaitingTime > MaxWaiting_sec * 1000)
{
Print("The waiting limit exceeded (" + MaxWaiting_sec + " seconds.)!");
return(-2);
}
if(IsTradeAllowed())
{
Print("Trade context has become free!");
return(0);
}
}
}
else
{
return(1);
}
}
//+------------------------------------------------------------------+
//| calculating progression long lots |
//+------------------------------------------------------------------+
double Get_Buy_Lots()
{
int total = OrdersTotal();
for (int cnt = total-1 ; cnt >= 0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == Magic_Number_Buy && OrderSymbol()==Symbol() && OrderType()==OP_BUY)
{
if(Progression_Allowed==false)
{
return(Initial_Lots);
}
//----------
if(Progression_Allowed==true)
{
if(OrderProfit()<0)
{
return(NormalizeDouble(OrderLots()*Lots_Multiply_Factor,2));
}
}
}
}
}
//+------------------------------------------------------------------+
//| calculating progression short lots |
//+------------------------------------------------------------------+
double Get_Sell_Lots()
{
int total = OrdersTotal();
for (int cnt = total-1 ; cnt >= 0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == Magic_Number_Sell && OrderSymbol()==Symbol() && OrderType()==OP_SELL)
{
if(Progression_Allowed==false)
{
return(Initial_Lots);
}
//----------
if(Progression_Allowed==true)
{
if(OrderProfit()<0)
{
return(NormalizeDouble(OrderLots()*Lots_Multiply_Factor,2));
}
}
}
}
}
//+------------------------------------------------------------------+
//| counting trades |
//+------------------------------------------------------------------+
int Count_All()
{
int i, total, count;
total=OrdersTotal();
if (total==0)
{
return(0);
}
count=0;
for(i=0;i<total;i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()==Symbol())
if(OrderMagicNumber() == Magic_Number_Buy || OrderMagicNumber() == Magic_Number_Sell)
{
count++;
}
} // for
return(count);
}
//+------------------------------------------------------------------+
//| closing trades |
//+------------------------------------------------------------------+
int Close_One_By_One()
{
int i, total5;
total5=OrdersTotal();
if (total5==0)
{
return(0);
}
for (i = total5-1 ; i >= 0 ; i--)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
if(OrderMagicNumber() == Magic_Number_Buy || OrderMagicNumber() == Magic_Number_Sell)
{
if(OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
return(0);
}
else /*OP_SELL*/
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
return(0);
}
} // if ordertype
} // for
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void Comment_Stopped()
{
Comment
(
//"Initial_Lots = "+DoubleToStr(Initial_Lots,2),"\n",
//"Max_Trades = "+Max_Trades,"\n",
//"Pip_Step = "+Pip_Step,"\n",
//"Max_Price_Level = "+DoubleToStr(Max_Price_Level,4),"\n",
//"Min_Price_Level = "+DoubleToStr(Min_Price_Level,4),"\n",
//"Use_Equity_Profit_Take = "+Use_Equity_Profit_Take,"\n",
//"Dollar_Equity_Profit_Take = "+DoubleToStr(Dollar_Equity_Profit_Take,0),"\n",
//"Use_Equity_Loss_Cut = "+Use_Equity_Loss_Cut,"\n",
//"Dollar_Equity_Loss_Cut = "+DoubleToStr(Dollar_Equity_Loss_Cut,0),"\n","\n",
"STOPPED BY USER"
);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
/*
void Comment_Null()
{
Comment
(
"Initial_Lots = "+DoubleToStr(Initial_Lots,2),"\n",
"Max_Trades = "+Max_Trades,"\n",
"Pip_Step = "+Pip_Step,"\n",
"Max_Price_Level = "+DoubleToStr(Max_Price_Level,4),"\n",
"Min_Price_Level = "+DoubleToStr(Min_Price_Level,4),"\n",
"Use_Equity_Profit_Take = "+Use_Equity_Profit_Take,"\n",
"Dollar_Equity_Profit_Take = "+DoubleToStr(Dollar_Equity_Profit_Take,0),"\n",
"Use_Equity_Loss_Cut = "+Use_Equity_Loss_Cut,"\n",
"Dollar_Equity_Loss_Cut = "+DoubleToStr(Dollar_Equity_Loss_Cut,0),"\n","\n",
"RUNNING"
);
}
*/
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void Comment_PL(string bs, double Profit_Or_Loss, int total6)
{
Comment
(
"\n",
"Active Orders = " + Count_All(),"\n",
"Profit/Loss = " + DoubleToStr((AccountEquity()-AccountBalance()),2) //,"\n",
//"Profit/Loss = "+ DoubleToStr(Profit_Or_Loss,2)//,"\n",
//"Initial_Lots = "+DoubleToStr(Initial_Lots,2),"\n",
//"Max_Trades = "+Max_Trades,"\n",
//"Pip_Step = "+Pip_Step,"\n",
//"Max_Price_Level = "+DoubleToStr(Max_Price_Level,4),"\n",
//"Min_Price_Level = "+DoubleToStr(Min_Price_Level,4),"\n",
//"total = "+total6,"\n",
//"Use_Equity_Profit_Take = "+Use_Equity_Profit_Take,"\n",
//"Dollar_Equity_Profit_Take = "+DoubleToStr(Dollar_Equity_Profit_Take,0),"\n",
//"Use_Equity_Loss_Cut = "+Use_Equity_Loss_Cut,"\n",
//"Dollar_Equity_Loss_Cut = "+DoubleToStr(Dollar_Equity_Loss_Cut,0),"\n","\n",
//bs
);
}
//----------------------------------------
Actually .. Did not finish to add the points that I mentioned to you
We are still trying with my friend to modify these points
I hope you help me with reported :)
...(code)...This is the code : Rubber_Band_v.3.3.mq4
Thank you for your code. You have filled up things missing in my code, such as trade contexts and time control. The coming RUBBERBANDS_3 may contain your points, I guess, in different forms. Just wait and see..
look in the left side on my live account
ea rubberbands 3.3 here in the form the profit/loss in not the same as a demo on alpari lol can we fix it whats the reason....
......it is my kediet....lol
can we fix it
rubber bands 3.3 with some ajustments.......
extern double Lots_up_when_losing=0.01;//
...........
........
return(NormalizeDouble(OrderLots()+Lots_up_when_losing,2));
2 times in the code 3.3
tester on 3000eur
2 years steady grow almost 100 percent
max trades 10
pipstep 50
profit take 1200
im not sure thats not working on a live account help me with credit see down
eur/chf 1 hour
on alpari 5digits every tick
follow in demo:
http://hulspas.mt4stats.com/<figure>
look in the left side on my live account
ea rubberbands 3.3 here in the form the profit/loss in not the same as a demo on alpari lol can we fix it whats the reason....
......it is my kediet....lol
can we fix it
Your result is amazng! The displayed profit/loss value is an approximate one, calculated just before closing.
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.....:-)
Hi St Jojo etal,
I’m a new comer to the ForEx, but have used computers for over 30 years and have done a little bit of programming along the way. I have read your description of your RubberBands EA and understand how and why it works and think it is a good approach as well. From the little bit I have learned this is a type of Martingale system like PipMaker though I may be mistaken about it being an apt description of your approach.
They both are great profit makers, but their downfall is that the losing trades don’t get canceled out EARLY. A tight Stop Loss on the losing trade of hedging pairs makes it very profitable. I also have a great little commercial utility from PipBoxer.Com that is a 2 stage Trailing Stop Loss (PBTS) that helps these systems and is very reasonably priced. It works with your RubberBands AE but unfortunately not with PipMaker.
When I use these programs more in a Scalping mode, which they are great for as they recognize and place a lot of trades very quickly (when your AE is in ‘Safety Mode’) and manually close out the losing trade very early as soon it is clear which of the trades is definitely losing money and the other one of the pair is making money both of these approaches are VERY profitable.
I have no experience programming MT4 and I don’t know if personal circumstances will permit me to undertake programming in this area. At this stage if I am going to do it I will wait till MT5 comes out very soon.
I appeal to you as well as other programmers to put an adjustable Stop Loss and preferably a Trailing Stop Loss as well onto both your RubberBands AND PipMaker and these systems will be GREAT and VERY profitable EAs.
Thanks for sharing. (8 >) Prosperous Trading (< 8)
DougRH