Help Finish My Ea?

 

Ok,

I hate to say it but I'm desperate :)

Can someone help me fix this EA. I have 2 issue's.

1) It doesn't heed the donchians. When the Donchian crosses the Nolag its not suppose to buy anymore...

2) Sometimes it makes the same order. When it stop losses on a sell it sells again and stop losses... I'd like to get it to stop for 15 minutes, but this is secondary to #1, because its sending in orders at the crest...

Thank You

Files:
nojlagmea.zip  39 kb
 
GrStaKa wrote >>

Ok,

I hate to say it but I'm desperate :)

Can someone help me fix this EA. I have 2 issue's.

1) It doesn't heed the donchians. When the Donchian crosses the Nolag its not suppose to buy anymore...

2) Sometimes it makes the same order. When it stop losses on a sell it sells again and stop losses... I'd like to get it to stop for 15 minutes, but this is secondary to #1, because its sending in orders at the crest...

Thank You

:)

I see you have posted the pic in another thread. Is there any shift -ve value in one of your indicators? If you use them, the trade may be occuring before the cross actually happening or the lag hence the the buy condition is met before it becomes a bad trade. To help you further, pls tell me whether this is your own EA, or how long it has been tested (forward testing), how good it is in manual trading? :) j/k.

Goodluck.

 
Hi, we can have a look please submit the request to www.forexcoding.com
 
Kent wrote >>

:)

I see you have posted the pic in another thread. Is there any shift -ve value in one of your indicators? If you use them, the trade may be occuring before the cross actually happening or the lag hence the the buy condition is met before it becomes a bad trade. To help you further, pls tell me whether this is your own EA, or how long it has been tested (forward testing), how good it is in manual trading? :) j/k.

Goodluck.

I just checked the shift, I did have one on there so I took it off and went for a displace (since its #'s not a shift). It's still doing it there. I'll try hard coding a devation into it I guess.

Otherwise ... manual trading? I learned this from a chap that hasn't lost a trade in 5 years.

This started out as one of those "create your own EA's" from a website. I attempted to incorperated several EA's unsuccesfully. Basically I said to my self "whats the simplest EA you can make?" Answer: bar goes up buy, bar goes down sell. So I did that and back tested for 60k in 3 months. Only problem is the reverse on the trend lines. I added the trailing stop mods so it moves take profit up as well (so you just don't break even or take a hit... the trailing stop moves your TP up as it raises your SL). Nifty bit of code there... ton's easier to do than one would think. I need to add in a bar counter so that it doesn't stop loss early on an up trend and makes it to the crest. Otherwise I've modified the nolag MA to break out an upper and lower indicator, I did the same with the donchians. So technically? Its mine? I've //'d out everyone elses stuff I've tried to incorperate to date. Looks like the donchian and nolag's are the next to get //'d.

All in all I've burned through a ton of EA's and thrown em all away. All I want is a trend reversal mechanism. If I could draw a line 70% above and below the Median Average, I'd call that that.

 
GrStaKa wrote >>

I just checked the shift, I did have one on there so I took it off and went for a displace (since its #'s not a shift). It's still doing it there. I'll try hard coding a devation into it I guess.

Otherwise ... manual trading? I learned this from a chap that hasn't lost a trade in 5 years.

This started out as one of those "create your own EA's" from a website. I attempted to incorperated several EA's unsuccesfully. Basically I said to my self "whats the simplest EA you can make?" Answer: bar goes up buy, bar goes down sell. So I did that and back tested for 60k in 3 months. Only problem is the reverse on the trend lines. I added the trailing stop mods so it moves take profit up as well (so you just don't break even or take a hit... the trailing stop moves your TP up as it raises your SL). Nifty bit of code there... ton's easier to do than one would think. I need to add in a bar counter so that it doesn't stop loss early on an up trend and makes it to the crest. Otherwise I've modified the nolag MA to break out an upper and lower indicator, I did the same with the donchians. So technically? Its mine? I've //'d out everyone elses stuff I've tried to incorperate to date. Looks like the donchian and nolag's are the next to get //'d.

All in all I've burned through a ton of EA's and thrown em all away. All I want is a trend reversal mechanism. If I could draw a line 70% above and below the Median Average, I'd call that that.

Thanks for your detailed reply. First I would not value much to the backtested results. They donot mean much. If you have consistant 3 month+ forward testing it may be a good start. Not trying to disappoint you but just based on my experience in testing EAs,etc. Also if a logic works good in manual/forward trading it can be made to an EA provided if you can write a reasonable Psuedocode/in plain English first. Having the TL is great but your main buy/sell logic and basic entry/exit rules should be clearly written and that should be a good start. If I guess correctly, your buy happens at the top of the donchian channel where the trend is almost done and ready to reverse to a short? So you have to see how you trade this manually if that is the case, and design your EA accordingly. I am not trying to discourage you but most good EAs wouldnot get published ofcourse some may be willing to share the logic or some parts of code. Goodluck.

 

Hello GrStaKa

edit: just opened up .zip and see v7.1 not use Point and does bit more reasonable code. I should have looked first. I stick to v5 as not so top heavy, each new ver gets more gunk tacked on...

For the fun of it, do below on M1 (might be more to liking on M5 or M15 chart. ie, seems to vary according to ccy and period). If for no other reason, may look interesting... :)
(thats 1xDonchian + 2xNoLag)

(see edit above) btw, IF using 3,5 Broker you should consider making code that uses Point predefine aware of 2,4/3,5 prices.

Point is used in two code blocks, each guarded by conditionals: (Filter>0) and (Color>0) respectively.

eg:

1. put as global scope: double gdSubPipMultiplier=1.0; //default to 2,4 broker
2. in init() put: if(Digits==3||Digits==5) gdSubPipMultiplier = 10.0;
3. wherever Point is used (3 places) put: Point*gdSubPipMultiplier

NOTE: many ways to deal with subPip prices. I choose to not have universal eg: _Point which was setup in init(). I prefer the multiplier variable...

  1. Donchian.mq4 (https://www.mql5.com/en/code/8965)

periods=10

  • NonLagMA_v5.mq4 (appears that most have same code body so Vnn could be seen as irrelevant)
  1. Price = 2
    Length = 8
    Displace = 0
    Filter = 0
    Color = 1
    ColorBarBack = 1
    Deviation = 0.04
  • NonLagMA_v5.mq4
  1. Price = 3
    Length = 8
    Displace = 0
    Filter = 0
    Color = 1
    ColorBarBack = 1
    Deviation = -0.04

    ahhh... //| This MQL is generated by Expert Advisor Builder |
    have fun...

    your ref: "// is this where it closes.."

    in 13th: search on "OrderClose"

     
    Kent wrote >>

    Thanks for your detailed reply. First I would not value much to the backtested results. They donot mean much. If you have consistant 3 month+ forward testing it may be a good start. Not trying to disappoint you but just based on my experience in testing EAs,etc. Also if a logic works good in manual/forward trading it can be made to an EA provided if you can write a reasonable Psuedocode/in plain English first. Having the TL is great but your main buy/sell logic and basic entry/exit rules should be clearly written and that should be a good start. If I guess correctly, your buy happens at the top of the donchian channel where the trend is almost done and ready to reverse to a short? So you have to see how you trade this manually if that is the case, and design your EA accordingly. I am not trying to discourage you but most good EAs wouldnot get published ofcourse some may be willing to share the logic or some parts of code. Goodluck.

    Not A problem Kent. I heeded your advice from the origonal post:

    Total trades 61

    Short positions won 7 (100.00%)

    Long positions won 54 (94.44%)

    Not as many trades as I wanted but I'm working with different indicators. Someone posted some code for me on another forum to just draw a line... thats all I'm looking for in the long run. I'm going to switch to V5 like the poster above suggested as well. My modified donchians aren't garnishing active results just like you suggested. Otherwise the strat is solid. You need a better program than Meta4 to use it "with ease" though.. Heck, its extremely hard translating this stuff to code. Drives me nutz I waltz onto another platform at my mentors house, click 3 buttons and make 900$ in under 3 minutes.... well watch him do it. But I'm the IT guy and he's the brain? Someone's gotta translate this stuff into a working automaton.

    I'm still trying to digest this:

    (see edit above) btw, IF using 3,5 Broker you should consider making code that uses Point predefine aware of 2,4/3,5 prices.

    Point is used in two code blocks, each guarded by conditionals: (Filter>0) and (Color>0) respectively.

    eg:

    1. put as global scope: double gdSubPipMultiplier=1.0; //default to 2,4 broker
    2. in init() put: if(Digits==3||Digits==5) gdSubPipMultiplier = 10.0;
    3. wherever Point is used (3 places) put: Point*gdSubPipMultiplier

    But I wont have time until tomorrow.

     

    GrStaKa

    Below is amplification - (maybe :)

    The subpip broker pricing is really just general heads up info.

    Plenty searchable info on this site.

    Regards v5, you will see that just using Point*<intValue> will be right shifted by one place if 3,5 price feed.

    viz: if 0.01/0.0001 (2,4) * 5 you get 0.05/0.0005

    if attempt as above but with subpips 0.001/0.00001 (3,5) * 5 you get 0.005/0.00005, all of a sudden your 5 pip TP or SL ... is divided by 10

    just depends on your data feed and easily determined via either Digits for current chart sym or MarketInfo(<symName>,MODE_DIGITS) for any sym

    Regards

     
    fbj wrote >>

    GrStaKa

    Below is amplification - (maybe :)

    The subpip broker pricing is really just general heads up info.

    Plenty searchable info on this site.

    Regards v5, you will see that just using Point*<intValue> will be right shifted by one place if 3,5 price feed.

    viz: if 0.01/0.0001 (2,4) * 5 you get 0.05/0.0005

    if attempt as above but with subpips 0.001/0.00001 (3,5) * 5 you get 0.005/0.00005, all of a sudden your 5 pip TP or SL ... is divided by 10

    just depends on your data feed and easily determined via either Digits for current chart sym or MarketInfo(<symName>,MODE_DIGITS) for any sym

    Regards

    Oh... This might explain why I am having trouble adjusting the Trailing stop to modify to the bar height. I noticed that a few of the indicators where on 2,4 and I'm on 3,5.

    Good info FBJ! Thank you!

    Reason: