Forex



Go Back   Forex Trading > Discussion Areas > General Discussion
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #21 (permalink)  
Old 10-10-2008, 06:46 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 516
Beno is on a distinguished road
Here is the ea with that I think fixed the trade context busy problem but it's not working
I have this when compiling
Function "_IsTradeAllowed" is not referenced and will be removed from exp-file
and this when trying to run

2008.10.10 18:29:26 Cannot open file 'C:\Program Files\FXDD - MetaTrader 4\experts\PEA2.ex4' on the ,

any hints as to where I could have gone wrong

I have attached the tradecontext include file

Cheers

Beno
Attached Files
File Type: mq4 PEA2.mq4 (17.7 KB, 50 views)
File Type: mq4 TradeContext.mq4 (9.3 KB, 60 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #22 (permalink)  
Old 11-01-2008, 12:10 AM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 516
Beno is on a distinguished road
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
Attached Files
File Type: mq4 EPA.mq4 (21.9 KB, 68 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #23 (permalink)  
Old 01-18-2009, 03:42 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 516
Beno is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #24 (permalink)  
Old 05-15-2009, 09:07 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 516
Beno is on a distinguished road
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
Attached Files
File Type: mq4 REAP.mq4 (13.0 KB, 57 views)
File Type: mq4 TradeContext.mq4 (7.8 KB, 49 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #25 (permalink)  
Old 05-18-2009, 12:24 PM
cockeyedcowboy's Avatar
Senior Member
 
Join Date: Nov 2005
Posts: 486
cockeyedcowboy is on a distinguished road
Beno

your code is very long and can be shorten, I have no time to rewrite it but here is the code block I use that works you are going to have to rewrite it as it is part of my code library and will not work without the rest of the library modules. It is quit simple. the system key is your magic number so all EAs will need a different number and all copies of the same EA will need different magic numbers too.

I'am off for a week going to the forest will check back when I return;

Keit
Attached Images
File Type: jpg Clipboard01.jpg (152.5 KB, 192 views)

Last edited by cockeyedcowboy; 05-18-2009 at 12:28 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #26 (permalink)  
Old 06-03-2009, 08:27 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 516
Beno is on a distinguished road
Gidday

Could someone please help me out with a coding solution?

I am still getting the Trade Context Busy error as well as Old Tick.

I have been trying to figure out how to utilise the solutions over on mql4.com

But it’s not working so any help would be great.

Cheers

Beno
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #27 (permalink)  
Old 07-22-2009, 06:01 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 516
Beno is on a distinguished road
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
Attached Images
File Type: gif DetailedStatement.gif (5.4 KB, 77 views)
Attached Files
File Type: htm DetailedStatement.htm (89.7 KB, 14 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #28 (permalink)  
Old 07-22-2009, 06:06 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 516
Beno is on a distinguished road
FxPro Demo Account.

Similar Results.
Attached Images
File Type: gif DetailedStatement.gif (5.4 KB, 74 views)
Attached Files
File Type: htm DetailedStatement.htm (51.2 KB, 12 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #29 (permalink)  
Old 07-22-2009, 10:58 PM
cockeyedcowboy's Avatar
Senior Member
 
Join Date: Nov 2005
Posts: 486
cockeyedcowboy is on a distinguished road
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.





Quote:
Originally Posted by Beno View Post
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #30 (permalink)  
Old 07-22-2009, 11:40 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 516
Beno is on a distinguished road
In 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


Code:
//+------------------------------------------------------------------+
   //| 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;
   }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
pivot, Pivot system


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Only Pivot stevenali Manual trading systems 2691 08-15-2009 04:28 PM
Pivot indicator which ONLY displays Current DAY's Pivot lines.. Kent Indicators - Metatrader 4 0 07-18-2007 01:03 AM
A Pivot Based System kalahariduin Suggestions for Trading Systems 20 12-08-2006 10:26 PM
Pivot Point System jebigabre Suggestions for Trading Systems 2 08-27-2006 07:28 AM
Pivot System cucurucu Suggestions for Trading Systems 101 04-21-2006 05:09 PM


All times are GMT. The time now is 09:42 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.