Forex
Google
New signals service!

Go Back   Forex Trading > Trading systems > Martingale/Average Cost and Hedging


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack (51) 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!
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, 348 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!
Reply With Quote
  #33 (permalink)  
Old 06-23-2007, 05:08 PM
Neo Neo is offline
Junior Member
 
Join Date: Jun 2006
Posts: 28
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!
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!
Reply With Quote
  #35 (permalink)  
Old 06-25-2007, 08:41 AM
organaiz's Avatar
Junior Member
 
Join Date: May 2006
Location: Douala - Cameroun
Posts: 5
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!
Reply With Quote
  #36 (permalink)  
Old 06-25-2007, 02:54 PM
Neo Neo is offline
Junior Member
 
Join Date: Jun 2006
Posts: 28
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!
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!
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!
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!
Reply With Quote
  #40 (permalink)  
Old 06-26-2007, 03:56 AM
Senior Member
 
Join Date: Jun 2006
Posts: 369
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!
Reply With Quote
Reply

Bookmarks

Tags
adaptive RSI, forex tsd, forex-tsd, Pipmaker, pipmaker ea, pipmaker forex, PIPMAKER V15, tsd forex, pallada, price action, PipMakerV5aNeo, i_Trend.ex4, price action ea, pipmaker 9-1, forex pipmaker, PipMaker mq4, pipmaker v9

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/martingale-average-cost-hedging/8126-pipmaker-v1-price-action-based-ea.html
Posted By For Type Date
Bless EA [zmodykifowana] This thread Refback 09-09-2008 09:53 PM
Bless EA [zmodykifowana] This thread Refback 08-17-2008 04:23 AM
Bless EA [zmodykifowana] This thread Refback 08-06-2008 08:05 PM
Bless EA [zmodykifowana] This thread Refback 08-06-2008 10:53 AM
Bless EA [zmodykifowana] This thread Refback 07-29-2008 12:07 PM
Per tutti: Expert Advisor/Strategia da valutare - Forex Forum This thread Refback 06-26-2008 09:37 AM
FX扑旦氾丞玄伊□玉憤がыъ撢薨撮 Post #1021 Refback 06-24-2008 02:16 PM
FX扑旦氾丞玄伊□玉憤がыъ撢薨撮 Post #1021 Refback 06-14-2008 04:09 PM
丟正玄伊□母□分丑〞﹛ 200805 This thread Refback 06-06-2008 03:17 PM
Per tutti: Expert Advisor/Strategia da valutare - Forex Forum This thread Refback 04-15-2008 12:39 PM
^g!@SXX: PipMaker This thread Refback 03-28-2008 02:42 AM
^g!@SXX: tEA!! This thread Refback 03-26-2008 12:06 AM
^g!@SXX This thread Refback 03-25-2008 11:15 PM
Expert Advisor | Forex MetaTrader Expert Advisors | Over 40 of the Best EA's for MT4 on Squidoo This thread Refback 03-14-2008 04:32 AM
Expert Advisor | Forex MetaTrader Expert Advisors | Over 40 of the Best EA's for MT4 on Squidoo This thread Refback 03-09-2008 07:41 PM
Expert Advisor | Forex MetaTrader Expert Advisors | Over 40 of the Best EA's for MT4 on Squidoo This thread Refback 03-07-2008 02:31 AM
≠MT4∞MetaTrader Part8≠丟正玄伊□母□∞ - MetaTrader引午戶Wiki This thread Refback 02-24-2008 06:14 AM
ゞ堣吨韝リ滮咫韝リ漶式式再ll you need is TREND〞﹋移鎖﹌ This thread Refback 02-23-2008 08:51 PM
Per tutti: Expert Advisor/Strategia da valutare - Forex Forum This thread Refback 02-23-2008 11:01 AM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 16 - Sarmaye Forums This thread Refback 02-21-2008 12:27 AM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 16 - Sarmaye Forums This thread Refback 02-13-2008 06:28 AM
TSD及白巧□仿丞尺及伉件弁 | 1坳晚井日杴隙允葆鳳莢汊 This thread Refback 02-09-2008 09:35 PM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 16 - Sarmaye Forums This thread Refback 02-08-2008 01:34 PM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 15 - Sarmaye Forums This thread Refback 02-08-2008 01:18 PM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 16 - Sarmaye Forums This thread Refback 02-07-2008 12:16 AM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 16 - Sarmaye Forums This thread Refback 02-06-2008 03:30 PM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 16 - Sarmaye Forums This thread Refback 02-06-2008 07:43 AM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 16 - Sarmaye Forums This thread Refback 02-06-2008 06:23 AM
塈琠堻椈堭堛塈 堻堹堹 !!! - 媯堶 16 - Sarmaye Forums This thread Refback 02-06-2008 06:03 AM
200801 ゞ堣吨韝リ滮咫韝リ漶式式再ll you need is TREND〞﹋移鎖﹌ This thread Refback 02-03-2008 08:40 AM
Per tutti: Expert Advisor/Strategia da valutare - Forex Forum This thread Refback 01-31-2008 07:00 PM
ゞ堣吨韝リ滮咫韝リ漶式式再ll you need is TREND〞﹋移鎖﹌ This thread Refback 01-30-2008 07:57 AM
20080116 ゞ堣吨韝リ滮咫韝リ漶式式再ll you need is TREND〞﹋移鎖﹌ This thr