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
Please give this a go it seems to works quite well on BT I have not done any Forward testing or optimization but it looks good on the JPY pairs and the majors.
IMHO this is a coin toss EA as from the bar pivot we don't know where the open of the new bar is going to be.
If some one wants to change the MM system feel free maybe a martingale or a cost averaging.
I have one idea but it's seem to complicated to code. pm me if you want to give it a crack.
Cheers
Beno
I would like some help please.
I have been thinking and experimenting with this EA but can't seem to get it right.
Want I would like to do is on each bar open a buy and sell each with there own exit point. both with the option of a ema exit or the Percentage exit.
when a position is opened then price tends to flow over and under the bar pivot point so I am looking to take advantage of that.
one of the problems with this is if several position do not close out you could end up with a every growing float. a potential soluion is to close out every position on the open of a new bar.
What do you think.
Let me know.
Cheers
Beno
Reap
Hello
Attached is a new version of the bar pivot EA I have added a mm system I found some where and an experiment with using the previous bars range as the SL, TP, and TS. it produces some ok results.
also I have been trying to fix the trade context problem but is still not working quite right if some kind soul could have a look into why it not working that would be great.
After using this for a short while I think this could be a good candidate for a martingale style system.
Using the standard mm thats in the system and doubling up after loss 1 the 1.5 for loss 2 then 1.75 for loss 3 if there are 3 losses in a row then revert back to standard mm
I think the 4hr TF on any pair is but this will need more testing.
Any way have a look and let me know.
I have Called it REAP: Range Expert Advisor Pivot.
Cheers
Beno
Current Forward Testing
All looks good but I am still having the Trade Context Busy problem.
cockeyedcowboy I am attempting to use your code thanks for posting it.
Cheers
Beno
FxPro Demo Account.
Similar Results.
Beno
How many orders does your system open? or are you runing more then one EA / termial at one time? If you can post the journal logs so one can see the errors. and if you like you can post just the order part of your code for which I will write a switch for you.
Current Forward Testing
All looks good but I am still having the Trade Context Busy problem.
cockeyedcowboy I am attempting to use your code thanks for posting it.
Cheers
BenoIn essence there is no limit it all depends on the TF that is chosen but the most I have seen is 62 on while testing using the 1 hr time frame. on 12 pairs.
2009.07.22 22:00:03 '1133682': instant order sell 0.10 GBPNZD at 2.5019 sl: 2.6263 tp: 2.3814
2009.07.22 22:00:02 Publisher: starting
2009.07.22 22:00:02 '1133682': order was opened : #5216434 sell 0.10 EURCHF at 1.51514 sl: 1.52968 tp: 1.50130
2009.07.22 22:00:02 '1133682': request in process
2009.07.22 22:00:02 '1133682': request was accepted by server
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order sell 0.10 USDDKK opening at 5.2342 sl: 5.4022 tp: 5.0692 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order sell 0.10 EURCAD opening at 1.5630 sl: 1.6359 tp: 1.4916 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order buy 0.10 GBPUSD opening at 1.64921 sl: 1.59182 tp: 1.70630 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order buy 0.10 GBPSGD opening at 2.3789 sl: 2.3274 tp: 2.4279 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order sell 0.10 SGDJPY opening at 64.91 sl: 69.36 tp: 60.55 failed [Trade context is busy]
2009.07.22 22:00:02 '1133682': instant order sell 0.10 EURCHF at 1.51514 sl: 1.52968 tp: 1.50130
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order buy 0.10 CADJPY opening at 85.22 sl: 77.78 tp: 92.57 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
//| Variable End |
//+------------------------------------------------------------------+
//Check position
bool IsTrade = False;
for (int i = 0; i < Total; i ++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
IsTrade = False;
if(OrderType() == OP_BUY) {
//Close
//+------------------------------------------------------------------+
//| Signal Begin(Exit Buy) |
//+------------------------------------------------------------------+
if (exit) Order = SIGNAL_CLOSEBUY;
//+------------------------------------------------------------------+
//| Signal End(Exit Buy) |
//+------------------------------------------------------------------+
if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(UseTrailingStop)TrailingStop = MarketInfo(Symbol(),MODE_STOPLEVEL)/dXPoint;{
if(Bid - OrderOpenPrice() > (TrailingStop*dXPoint)*Point) {
if(OrderStopLoss() < Bid - (TrailingStop*dXPoint)*Point) {
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - (TrailingStop*dXPoint)*Point, OrderTakeProfit(), 0, MediumSeaGreen);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
} else {
//Close
//+------------------------------------------------------------------+
//| Signal Begin(Exit Sell) |
//+------------------------------------------------------------------+
if (exit) Order = SIGNAL_CLOSESELL;
//+------------------------------------------------------------------+
//| Signal End(Exit Sell) |
//+------------------------------------------------------------------+
if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(UseTrailingStop)TrailingStop = MarketInfo(Symbol(),MODE_STOPLEVEL)/dXPoint;{
if((OrderOpenPrice() - Ask) > ( (TrailingStop*dXPoint)*Point )) {
if((OrderStopLoss() > (Ask + (TrailingStop*dXPoint)*Point)) || (OrderStopLoss() == 0)) {
OrderModify(OrderTicket(), OrderOpenPrice(), Ask + (TrailingStop*dXPoint)*Point, OrderTakeProfit(), 0, DarkOrange);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
}
}
}
//+------------------------------------------------------------------+
//| Signal Begin(Entry) |
//+------------------------------------------------------------------+
if (Buy1_1 > Buy1_2) Order = SIGNAL_BUY;
if (Sell1_1 < Sell1_2) Order = SIGNAL_SELL;
//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+
//Buy
if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (UseStopLoss) StopLossLevel = Ask - StopLoss ; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Bid + TakeProfit ; else TakeProfitLevel = 0.0;
RefreshRates();
Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue < 0);
}
else
{
if (UseStopLoss) StopLossLevel = Ask - StopLoss; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Bid + exit ; else TakeProfitLevel = 0.0;
Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue < 0);
RefreshRates();
if(Ticket < 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("BUY order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
} else {
Print("Error opening BUY order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}
//Sell
if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (UseStopLoss) StopLossLevel = Bid + StopLoss; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Ask - TakeProfit ; else TakeProfitLevel = 0.0;
RefreshRates();
Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink < 0);
}
else
{
if (UseStopLoss) StopLossLevel = Bid + StopLoss; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Ask - exit ; else TakeProfitLevel = 0.0;
Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink < 0);
RefreshRates();
if(Ticket < 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("SELL order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
} else {
Print("Error opening SELL order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}
if (!EachTickMode) BarCount = Bars;
}Here is a pic of the current total orders.
I have made a few changes and thus created a new error of which I have no clue ow to fix.
2009.10.27 18:36:53 REAP GBPUSD,H1: TradeIsBusy() - GlobalVariableSetOnCondition ( "TradeIsBusy", 1.0, 0.0 ) - Error #4105
I think it might be traced back to the #include
could someone please shed some light on this error.
Cheers
Beno