Go Back   Forex-TSD > Trading systems > Martingale/Average Cost and Hedging
Forex Forum Register More recent 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
  #31 (permalink)  
Old 06-23-2007, 02:16 PM
don_forex's Avatar
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Quote:
Originally Posted by Neo View Post
Okay.... found a few things that needed attention and tidied up the source a little in the process.

Main things were:

1) removed a couple of redundant variables
2) added RefreshRates() at appropriate points

In CheckForBuy() & CheckForSell():

1) added a check for zero lot sizes
2) commented out the "for loops" around the calls to OrderSend() as I couldn't see what they achieved

In Start():

1) added checks for HighestBuyTicket, LowestBuyTicket, HighestSellTicket & LowestSellTicket being zero before trying to select/close the distant order


I've run a quick test from Sept 06 to June 07 and no errors are now being reported either for opening or closing orders. In the test, as a batch of SELLs was closed at a profit, the most losing BUY was also closed and vice-versa.

Obviously, some more checking would be good, just in case I've missed something but the updated source is here.....
I have never used the RefreshRates() before. The for loops was doing that. at least attempting to do that...

I ran backtests from '04 and in July of '04 the errors still occurred. I will look closer at the code and see if I can find anything.

Don
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
  #32 (permalink)  
Old 06-23-2007, 04:09 PM
don_forex's Avatar
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Reverting to a modified PM2

Version 2 seems to work the best of all the versions thus far. It lacks the Trend that will make the Margin safer, but the execution is best. I have added tidbits to update the code to include some of the updates that Neo has posted...

Neo -

I would like to implement a Trend to this version. I have been using a LWMA to achieve this. However, the close routines go all to hell with the introduction of the MA... Maybe you might have some ideas to incorporate it into the EA successfully.

Don
Attached Files
File Type: mq4 PipMakerv2a.mq4 (19.3 KB, 499 views)

Last edited by don_forex; 06-23-2007 at 04:14 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
  #33 (permalink)  
Old 06-23-2007, 05:08 PM
Neo Neo is offline
Member
 
Join Date: Jun 2006
Posts: 45
Neo is on a distinguished road
I'll take a look....
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
  #34 (permalink)  
Old 06-23-2007, 05:40 PM
don_forex's Avatar
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Close routines

What I have noticed with the PM2a is that the opposites work only when the price is at the very extremes. Higher than the HighestBuy or lower than the LowestSell... when the positive sell are above the MidPoint, the losing sell is NOT closing. same for the low buys not closing out the high buy... who would of thought simply adding a iMA would screw it up so badly...

Don
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
  #35 (permalink)  
Old 06-25-2007, 08:41 AM
organaiz's Avatar
Junior Member
 
Join Date: May 2006
Location: Abidjan - Cote d'Ivoire
Posts: 19
organaiz is on a distinguished road
Best time Frame

Quote:
Originally Posted by don_forex View Post
Version 2 seems to work the best of all the versions thus far. It lacks the Trend that will make the Margin safer, but the execution is best. I have added tidbits to update the code to include some of the updates that Neo has posted...

Neo -

I would like to implement a Trend to this version. I have been using a LWMA to achieve this. However, the close routines go all to hell with the introduction of the MA... Maybe you might have some ideas to incorporate it into the EA successfully.

Don
Good morning Don,

Firstly, sorry for my bad english, i don't speak good english.

Secondly, thanks to share your work with us.

So i'm very interest about your EA, so i want to test it in live on a demo account (3000$ Lot: 0.1), just want to run it while 3 at 5 months to see the results, so i want to know what is your best timeframe to run it.

Thanks
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
  #36 (permalink)  
Old 06-25-2007, 02:54 PM
Neo Neo is offline
Member
 
Join Date: Jun 2006
Posts: 45
Neo is on a distinguished road
Ok...found part of the problem, at least! The MinWait computation in the "Close in profit" functions is not fully supported in Strategy Test mode so replace the functions with these:

void CloseBuysinProfit()
{
double BuyProfit, LastBuyTime;

for (int i = OrdersTotal() - 1; i >= 0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && OrderType() == OP_BUY)
{
BuyProfit = OrderProfit() + OrderSwap() + OrderCommission();
if (OrderOpenTime() > LastBuyTime) LastBuyTime = OrderOpenTime();
if ((IsTesting() || TimeCurrent() - LastBuyTime >= MinTime) && BuyProfit > 0) OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
}
}
}
return;
}

//+-----------------------------------------------+
//| Closes all Sells in Profit
//+-----------------------------------------------+
void CloseSellsinProfit()
{
double SellProfit, LastSellTime;

for (int i = OrdersTotal() - 1; i >= 0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && OrderType() == OP_SELL)
{
SellProfit = OrderProfit() + OrderSwap() + OrderCommission();
if (OrderOpenTime() > LastSellTime) LastSellTime = OrderOpenTime();
if ((IsTesting() || TimeCurrent() - LastSellTime >= MinTime) && SellProfit > 0) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red);
}
}
}
return;
}


Neo
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
  #37 (permalink)  
Old 06-26-2007, 01:42 AM
don_forex's Avatar
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
cool.

I have replace those subroutines. I will try to add in the LWMA now and see if the closes work better...

Don
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
  #38 (permalink)  
Old 06-26-2007, 02:15 AM
don_forex's Avatar
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Close routines

The addition of the LWMA still screws up the closes. Frustrating.
All I did was create an LWMA variable.


extern int MAPeriod = 1200;

double Trend = iMA(NULL, 0, MAPeriod, 0, MODE_LWMA, MODE_CLOSE, 0);

And then call it up in the Buy and Sell trade criteria.

if (Ask < LowestBuy-(Spacing*Point) || Ask > HighestBuy + (TrendSpacing * Point) && Ask > Trend)

if (Bid > HighestSell + (Spacing * Point) || Bid < LowestSell - (TrendSpacing * Point) && Bid < Trend)


Don
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
  #39 (permalink)  
Old 06-26-2007, 02:22 AM
don_forex's Avatar
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Time Frame?

Quote:
Originally Posted by organaiz View Post
Good morning Don,

Firstly, sorry for my bad english, i don't speak good english.

Secondly, thanks to share your work with us.

So i'm very interest about your EA, so i want to test it in live on a demo account (3000$ Lot: 0.1), just want to run it while 3 at 5 months to see the results, so i want to know what is your best timeframe to run it.

Thanks
I use 1M time frame as there isn't any indicators involved.

I am trying to incorporate a LWMA and still will use a 1M tf.


Don
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
  #40 (permalink)  
Old 06-26-2007, 03:56 AM
fxnewbie's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 557
fxnewbie is on a distinguished road
Quote:
Originally Posted by don_forex View Post
I use 1M time frame as there isn't any indicators involved.

I am trying to incorporate a LWMA and still will use a 1M tf.


Don
Hi Don !!
I an shure that is a very good idea. I am backtesting in 30 min TF and getting interesting results (profit factor 3+ but a little high drawdown). I will forward test in that TF and post my results latter.

Regards,

Last edited by fxnewbie; 06-26-2007 at 04:17 AM.
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
adaptive RSI, ADAPTIVE RSI.EX4, ADXMA, bless ea, cache:QNp-4lQtnkIJ:www.forex-tsd.com/martingale-average-cost-hedging/8126-pipmaker-v1-price-action-b, don_forex, ea pipmaker, forex, forex pipmaker, Forex price action, forex price action EA, forex tsd, forex tsd pipmaker, forex-tsd, i_Trend.ex4, ordersend error 4051, pallada, pallada ea, pip maker, Pipmaker, pipmaker 15, pipmaker 9-1, pipmaker ea, pipmaker expert, pipmaker expert advisor, pipmaker forex, pipmaker Forex TSD, PipMaker mq4, PipMaker MT4, pipmaker settings, pipmaker v10, pipmaker v14, PIPMAKER V15, pipmaker v15_3, PipMaker v5, pipmaker v9, PipMakerV5aNeo, PipMaker_NeoV5a_Rodmod8.mq4, pipmaker_v15, Pipmaker_V15.mq4, Pipmaker_V15_4.mq4, Price, price action, price action ea, price action expert advisor, price action forex, price action forex trading, price action mq4, price action trading, slope direction line, slope direction line modified.mq4, Terminator, terminator ea, tsd forex, USD CDN Terminator EA, www.forex-tsd.com


Currently Active Users Viewing This Thread: 2 (1 members and 1 guests)
Misiek80
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
Price action reversal EA help !!!!! compro99 Expert Advisors - Metatrader 4 5 11-18-2009 06:39 PM
Want some action? FX of course Kirsty_FX Suggestions for Trading Systems 2 05-17-2007 02:15 AM
EA Based on Price Movement babarmughal Expert Advisors - Metatrader 4 10 05-29-2006 07:56 PM
Bar Action Shahzadfx Expert Advisors - Metatrader 4 16 04-04-2006 04:38 AM


All times are GMT. The time now is 12:22 AM.



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