I code your strategy into an EA

Moderator: moderators

brettnchris
rank: <50 posts
rank: <50 posts
Posts: 31
Joined: Mon Oct 05, 2009 2:34 pm
Reputation: 0
Gender: None specified

EA for my edge

Postby brettnchris » Tue Dec 01, 2009 3:33 pm

Hello I have a set up I use that uses two indicators.

1. 50 SMA Colored

2. CCI Alert


Buy Entry: Buy when 50 SMA is green and the CCI is over sold.

Sell Entry: Sell when 50 SMA is red and CCI is over bought.

Attached are the indicators that I am using the CCI is set up to alert when the criteria matches.

I think using a scale out method for exit is the best. This I am still working on. My thoughts are take half at an adjustable amount of pips and let half run to another pip target.

Stop would be percentage amount of account or an adjustable hard stop amount.

Please let me know if this can be done. Thank you....
Attachments
MA in Color_wAppliedPrice.ex4
(6.88 KiB) Downloaded 297 times
CCIFilter_Blubbb_mod (1).mq4
(6.39 KiB) Downloaded 296 times

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

trendme82
rank: <50 posts
rank: <50 posts
Posts: 16
Joined: Tue Dec 01, 2009 4:26 pm
Reputation: 0
Location: usa
Gender: None specified

MOVING AVERAGES ONLY

Postby trendme82 » Tue Dec 01, 2009 5:26 pm

its not as simple as enter exit strategy.
1. we need to set a signal condition, if signal condition is met, then it goes to step two. step two is another condition. If met then trade enters.

condition one: confirm market behavior
How? use several Moving averages, 5-50 (use about 6-7 different MA)
IF ALL MA averages are with a small Range, condition is met.

The purpose of this condition is to find a Consolidation.

Once consolidation is confirmed, then we can go to step two.

Condition Two: ( we use fractual to draw trendline Object) Once Price breaks Trendline, then condition two is Met.

Enter Condition: Once (MA Group_ ma 5-50) all Decline/incline then Order is Entered.

Exit strategy: We dont need one. We can use another EA to close our orders!!
Attachments
MA.gif
MA.gif (26.29 KiB) Viewed 4666 times

trendme82
rank: <50 posts
rank: <50 posts
Posts: 16
Joined: Tue Dec 01, 2009 4:26 pm
Reputation: 0
Location: usa
Gender: None specified

Postby trendme82 » Tue Dec 01, 2009 5:30 pm

I can be reached at 4xquestion@gmail.com for more explanation.

or Google talk at wschaarrand@gmail.com

trendme82
rank: <50 posts
rank: <50 posts
Posts: 16
Joined: Tue Dec 01, 2009 4:26 pm
Reputation: 0
Location: usa
Gender: None specified

Another Moving Average example

Postby trendme82 » Tue Dec 01, 2009 5:47 pm

IF we build this EA:

We need External parameters:
----------------------------------------------------------------
MA1- (we enter the value) Type (sma, ema) Open/close
MA2
MA3-
MA4-
etc, so we can choose our own MA combination.
----------------------------------------------------------




Moving Average Decline/incline calculation:

[0] bar Current value >or< [1] bar close // this will tell us if its incline or decline

* this will need to be run on Each Moving average that is assigned in the Moving Average Group.
Attachments
MA_1.gif
MA_1.gif (26.24 KiB) Viewed 4669 times

marblaa
rank: <50 posts
rank: <50 posts
Posts: 1
Joined: Mon Jun 01, 2009 6:19 pm
Reputation: 0
Location: London
Gender: Female

Postby marblaa » Wed Dec 02, 2009 2:12 am

!!!!!.
Last edited by marblaa on Thu Dec 03, 2009 12:16 am, edited 1 time in total.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
newschool
rank: 150+ posts
rank: 150+ posts
Posts: 489
Joined: Fri Aug 21, 2009 2:26 am
Reputation: 1
Gender: Male

Postby newschool » Fri Dec 18, 2009 2:52 am

farizu,
you told me your strategy was H1, so I coded it that way hehe. What you posted is H1 entries on a M15 chart. To make it versatile, just go into the code and replace all the "PERIOD_H1" by "0".

PINKPANTHER5,
I don't how you named your indicator so go into the EA code and change all the 4 "Triggerline" words to suit yours. Also, since this is a custom indicator, backtesting will be slow. So you need to go into the code of your indicator and replace the pink colored "Bars" to the number of past candles it will be using. For example "300". That way it will only lookback to that number, instead of checking all your history.
As you can see trading with this indicator only will give you few false signals. Also to avoid repainting, I delayed the trigger by 1 candle.

brettnchris,
I did your EA but realized it will trigger whenever the SMA is green (in a long trade). Is that what you want , or your trigger is when it changes from another color to green? Also there is some repainting so you will probably need to delay by 1 candle.

trendme,
the 2 conditions entry is still very easy to do. Basically I just use a logical AND. No problem for the different MAs too. The thing I don't understand is the "fractual that draws the trendline Object". Is it an indicator?

trendme82
rank: <50 posts
rank: <50 posts
Posts: 16
Joined: Tue Dec 01, 2009 4:26 pm
Reputation: 0
Location: usa
Gender: None specified

Postby trendme82 » Thu Dec 31, 2009 3:40 pm

(TRENDME) yeah the TWO trendlines are drawn by an Indicator;
Demark Trendlines..

The Demark TL finds the last two Fractals (Bill WIlliams Fractal) and connects the fractals with a line.
Cost for Code?
I can always add other features to the code later..

trendme82
rank: <50 posts
rank: <50 posts
Posts: 16
Joined: Tue Dec 01, 2009 4:26 pm
Reputation: 0
Location: usa
Gender: None specified

Postby trendme82 » Thu Dec 31, 2009 3:43 pm

All the Moving averges must be a external parameter so Each trader can adjust accordingly. I use 244 MA and most traders use 200ma

farizu
rank: <50 posts
rank: <50 posts
Posts: 14
Joined: Mon Apr 13, 2009 8:18 pm
Reputation: 0
Gender: None specified

Postby farizu » Tue Jan 05, 2010 8:20 pm

newschool wrote:farizu,
you told me your strategy was H1, so I coded it that way hehe. What you posted is H1 entries on a M15 chart. To make it versatile, just go into the code and replace all the "PERIOD_H1" by "0".



Many thanks newschool, you are absolutely correct, my bad :oops:

I am finding some encouraging results with this ea on gu, and i would be grateful if you would let me know how i should modify the code to allow for fractional trades. i.e. .01 lots for example. Right now I am unable to do so with the ea as it is currently configured.

Thanks again for your remarkable work...

User avatar
newschool
rank: 150+ posts
rank: 150+ posts
Posts: 489
Joined: Fri Aug 21, 2009 2:26 am
Reputation: 1
Gender: Male

Postby newschool » Thu Jan 07, 2010 2:27 am

farizu,
in the first few lines of code, you see "extern int Lots = 2;". That defines the Lots as a default integer of 2. To allow a fractional number, you change "int" for "double".

trendme,
I searched for that indicator but I think there are many versions, you have to put it in a file attachment here.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “MetaTrader”