Forex
Google

Go Back   Forex Trading > Trading systems > Martingale/Average Cost and Hedging
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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 (46) Thread Tools Display Modes
  #51 (permalink)  
Old 06-27-2007, 01:13 AM
don_forex's Avatar
don_forex don_forex is offline
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Thumbs up You Rock!!!

Quote:
Originally Posted by Neo View Post
Ok... you guys asked for it

The reason I didn't post the entire EA previously is that I generally "rewrite" EAs in my own formatting style which helps me work out what's going on. I also generally rename variables and functions, though that may just be OCD

Anyway, the major deviation from Don's version is that I grafted the magic number routine from Fifth's Blessing code and added error reporting to a text file. There are a few minor revisions too but the most important is that I added the trend filtering into the Start() function.

I've got a sneaking suspicion that the Martingale side of things isn't working correctly but that's no big shakes at the moment.

Opps... almost forgot! I converted all neccesary "extern bool" parameters into "extern int" so that you can use them in optimisation mode in the strategy tester (0 = false, 1 = true) - the boolean code is just commented out throughout so you can switch it back if you want.

If you find any other issues then I guess you'll let me know
VERY SWEET!! Your code kicks some butt!

I fixed the errors in the logic. Where you had (Ask - Bid > Trend), should have only been (Ask > Trend) and (Bid < Trend). I also took out the AverageDown and ProfitReducer as they weren't used or needed. I took out int Orders as this was used in a different setting and took it out of the Lot calculations. The part where Lots == 0, I took out the * CounterTrendMultiplier, that is only used in the actual calculations. I made the BuyPipTarget = ProfitTarget, same for the SellPipTarget. I added a bool RightSideLabel, that way you can turn on/off the right side label. I also added the ticket numbers to the comment block. Other than that, the code is very, very nice!! You did a GREAT JOB!!

I am attaching this to post #1...

Don

Last edited by don_forex : 06-27-2007 at 01:20 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #52 (permalink)  
Old 06-27-2007, 02:31 AM
crodzilla crodzilla is offline
Member
 
Join Date: Apr 2006
Location: Florida, USA
Posts: 60
crodzilla is on a distinguished road
Program Logic...

Don/Neo,
I have been playing around with this EA ever since Don posted it. I have performed many (visual) backtests to watch how it works. And I have seen every iteration of the EA since, until this last one. When I run the worst case scenario... from Nov 26, 2005 through to present, all of the low timeframe tests (boost on/off), eventually blow the account because of low equity. Even my ADX filter doesn't save the low timeframes.

I understand you don't think that the logic is working quite right for the orphaned open orders. I was thinking about how to nullify the orphaned orders, both long and short. Well, I am also a fan of hedging strategies and was thinking... if there was a way to ensure that the biggest losing open orders are paired with the biggest gaining orders (don't get closed out - and that are close to off-setting the loss), you could continue to make profitable orders inside the envelope (high-low of the market).

I'm not sure if I'm explaining it right, but, it seems that the logic needs to be more intelligent on how it closes profitable orders. It needs to offset the losers somehow, so that additional trades can be entered within the profit envelope (low range consolidations). Then if margin is needed, the EA would close offset orders to free the margin.

So, in essense, if several orders long and short have been established (there is always more of one than the other), and price makes new highs, the short orders would be offset by "close-by" long orders. Those long orders would not be liquidated because they become the hedge for the short orders. The long orders that are left over and are in excess of the hedges for the short orders would be closed for a profit. Price would continue to move. Now if price moves to new lows, the EA logic would ensure that the losing long orders are hedged by appropriate in-profit short orders, thus hedged.

I hope that I'm getting my point across. I wish my programming skills were up to my ideas concerning this logic process.

Great job, Don and Neo.

Carl
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #53 (permalink)  
Old 06-27-2007, 03:25 AM
don_forex's Avatar
don_forex don_forex is offline
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Original Theory

The original strategy we traded was to simply close all buys or sells once they met the profit level. This was very successful. The problem though was trending. If the price went high, you were stuck with a lot of sells open and conversely, if the price dropped, you were left with a bunch of buys. My partner started taking and closing three profitable orders along with one losing order once he met his profit goal of $20. He had a butt load of orders open and using this technique he was able to significantly reduce the number of open orders. I tried to code this but was unable to correctly identify the top three orders. He managed to come up with the current profitable order routine, so, we modified the technique to include all profitable orders and not just the top three. I think that using the top three orders in conjunction with the losing order might produce more profit and keep the margin tighter. What do you think?

Don
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #54 (permalink)  
Old 06-27-2007, 05:46 AM
lepiricus's Avatar
lepiricus lepiricus is offline
Senior Member
 
Join Date: Jun 2007
Posts: 209
lepiricus is on a distinguished road
I been tinkering w/ this EA the last couple of days. Is the new neo inspired version still to be used on 1m TFs primarily?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #55 (permalink)  
Old 06-27-2007, 05:47 AM
organaiz's Avatar
organaiz organaiz is offline
Junior Member
 
Join Date: May 2006
Location: Douala - Cameroun
Posts: 2
organaiz is on a distinguished road
Thanks

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
Thanks for your answer
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #56 (permalink)  
Old 06-27-2007, 09:52 AM
crodzilla crodzilla is offline
Member
 
Join Date: Apr 2006
Location: Florida, USA
Posts: 60
crodzilla is on a distinguished road
Yes...

Quote:
Originally Posted by don_forex View Post
The original strategy we traded was to simply close all buys or sells once they met the profit level. This was very successful. The problem though was trending. If the price went high, you were stuck with a lot of sells open and conversely, if the price dropped, you were left with a bunch of buys. My partner started taking and closing three profitable orders along with one losing order once he met his profit goal of $20. He had a butt load of orders open and using this technique he was able to significantly reduce the number of open orders. I tried to code this but was unable to correctly identify the top three orders. He managed to come up with the current profitable order routine, so, we modified the technique to include all profitable orders and not just the top three. I think that using the top three orders in conjunction with the losing order might produce more profit and keep the margin tighter. What do you think?

Don
Don,
It sounds like you should try to stick with your friends strategy. This current strategy will orphan a lot of open losses in a trend. There is no other way around it.

Carl
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #57 (permalink)  
Old 06-27-2007, 11:03 AM
Neo Neo is offline
Junior Member
 
Join Date: Jun 2006
Posts: 22
Neo is on a distinguished road
Hi, Don

The issue over closing the 3 most profitable vs all profitable orders will be broker-dependent. I believe FXDD offset longs & shorts so option 1 would be best, whereas most other brokers (my own included ) do not, so option 2 would be best in that case.

Perhaps the best solution would be the facility to select the method - I'll take a look later today as I'm sure it won't be difficult to achieve.

Neo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #58 (permalink)  
Old 06-27-2007, 12:10 PM
don_forex's Avatar
don_forex don_forex is offline
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Quote:
Originally Posted by Neo View Post
Hi, Don

The issue over closing the 3 most profitable vs all profitable orders will be broker-dependent. I believe FXDD offset longs & shorts so option 1 would be best, whereas most other brokers (my own included ) do not, so option 2 would be best in that case.

Perhaps the best solution would be the facility to select the method - I'll take a look later today as I'm sure it won't be difficult to achieve.

Neo
You are definitely a better programmer than I am. It will probably be quite easy for you. It was beyond my capabilities.

Don
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #59 (permalink)  
Old 06-27-2007, 02:24 PM
don_forex's Avatar
don_forex don_forex is offline
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
1M timeframe

Quote:
Originally Posted by lepiricus View Post
I been tinkering w/ this EA the last couple of days. Is the new neo inspired version still to be used on 1m TFs primarily?
Yes. I will pretty much always use the 1M timeframe.

Don
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #60 (permalink)  
Old 06-30-2007, 11:27 PM
lepiricus's Avatar
lepiricus lepiricus is offline
Senior Member
 
Join Date: Jun 2007
Posts: 209
lepiricus is on a distinguished road
This EA backtests very well even with massive drawdowns, but on forward testing it incures a massive drawdown and is painful to watch sometimes lol. Much potential here though. I just got to learn to walk away as it runs instead of worrinng about a dozen or so open positions.

Last edited by lepiricus : 07-01-2007 at 02:42 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
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
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!@SゥXX: PipMaker This thread Refback 03-28-2008 02:42 AM
^g!@SゥXX: tEA!! This thread Refback 03-26-2008 12:06 AM
^g!@SゥXX 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
FXなんでもかんでも・・・All 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 FXなんでもかんでも・・・All 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
FXなんでもかんでも・・・All you need is TREND!(仮題) This thread Refback 01-30-2008 07:57 AM
20080116 FXなんでもかんでも・・・All you need is TREND!(仮題) This thread Refback 01-27-2008 12:50 PM
悋擧愕拆惘惠悋 愕惆惆 !!! - 惶忰 15 - Sarmaye Forums This thread Refback 01-22-2008 08:16 PM
FXなんでもかんでも・・・All you need is TREND!(仮題) This thread Refback 01-18-2008 05:43 PM
FXなんでもかんでも・・・All you need is TREND!(仮題) This thread Refback 01-18-2008 03:32 AM
ブログを書いてる暇などない・・・ FXなんでもかんでも・・・All you need is TREND!(仮題) This thread Refback 01-17-2008 02:28 AM
FXなんでもかんでも・・・All you need is TREND!(仮題) This thread Refback 01-16-2008 12:34 PM
悋擧愕拆惘惠悋 愕惆惆 !!! - 惶忰 15 - Sarmaye Forums This thread Refback 01-09-2008 12:03 PM
悋擧愕拆惘惠悋 愕惆惆 !!! - 惶忰 15 - Sarmaye Forums This thread Refback 01-07-2008 09:33 PM
悋擧愕拆惘惠悋 愕惆 惆 !!! - 惶忰 15 - Sarmaye Forums This thread Refback 12-29-2007 05:07 PM
悋擧愕拆惘惠悋 愕惆 惆 !!! - 惶忰 15 - Sarmaye Forums This thread Refback 12-29-2007 01:28 PM
shez_78's bookmarks tagged with This thread Refback 12-27-2007 11:50 AM
Long Term Smooching Method - Page 2 - FXOpen Forex Forum | Forex review | Trading methods | Education | Analytics This thread Refback 12-11-2007 02:12 AM
Long Term Smooching Method - Page 2 - FXOpen Forex Forum | Forex review | Trading methods | Education | Analytics This thread Refback 12-10-2007 11:46 PM
Forex TSD| Metatrader Indicators and Experts Advisors This thread Refback 11-09-2007 09:11 PM
- Per tutti: Expert Advisor/Strategia da valutare This thread Refback 11-08-2007 08:02 PM
[Forex-PipmakerV9-1] Yang berminat untuk mendiskusikan EA ini silakan masuk...:)) - Kaskus - The Largest Indonesian Community This thread Refback 11-07-2007 03:18 PM
- Per tutti: Expert Advisor/Strategia da valutare This thread Refback 10-02-2007 07:02 PM
Backtester Bug when placing Orders... - Forex Trading Software Forum