I code your strategy into an EA

Moderator: moderators

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

I code your strategy into an EA

Postby newschool » Sun Nov 08, 2009 8:15 pm

Simply post the entry and exit triggers, I will then make an EA with the source in MQ4 available.

I do this because you will be able to automate your method, and at the same time it shares the knowledge of traders, turning small ideas in great strategies.



Here is an example blueprint you need to follow===

conditions for BUY:
Bid > Rsi20
AND Bid>MA50

close:
Bid = MA50
OR 3 red candles in a row
Attachments
farizu EA.mq4
Close the current trade if a contrarian signal appears.

But you can also choose to hedge or not (inputs).

Played with the interwine MAs a little.
(13.26 KiB) Downloaded 395 times
triggerline EA.mq4
(12.08 KiB) Downloaded 304 times
Last edited by newschool on Fri Jan 29, 2010 3:44 am, edited 5 times in total.

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

PINKPANTHER5
rank: 150+ posts
rank: 150+ posts
Posts: 216
Joined: Fri Feb 13, 2009 7:52 pm
Reputation: 0
Gender: None specified
Contact:

Postby PINKPANTHER5 » Sun Nov 08, 2009 8:49 pm

Can you make a Triggerline EA??

When the red and the green have crossed over we go log or short??

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 » Tue Nov 10, 2009 10:19 pm

Give me the link to the Triggerline indicator.

learning_fx
rank: <50 posts
rank: <50 posts
Posts: 4
Joined: Wed Nov 11, 2009 3:55 pm
Reputation: 0
Gender: None specified

Postby learning_fx » Fri Nov 13, 2009 4:38 am

NewSchool,

Could you change the sema-version10dragon-eu.mq4 to use the daily Sema's? I would like to test with daily Sema's and larger stops.

Thanks

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

Postby farizu » Fri Nov 13, 2009 11:12 pm

OK here is one, which has been really good on the 1hr time frame on most major pairs. Let me know if you can turn it into an ea?

The setup:

First:

4 EMA lines set to periods 10,20,30 and 40

Second:
MACD set to the following settings:
Fast EMA: 5
Slow EMA: 31
MACD SMA: 1

Trading Strategy:

When all 4 EMA lines intertwine and MACD line rises from below 0 into the positive side, a BUY signal is triggered.

When all 4 EMA lines intertwine and MACD line drops from above 0 into the negative side, a SELL signal is triggered.

Exit is a 30pip trailing sl.

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 » Sun Nov 22, 2009 9:50 pm

learning_fx,
I do not support anymore the Sema EA, but it very easy to change it to daily, just go in the source and change the PERIOD_H1 to PERIOD_D1. You can also change the Open price of the candles to something like M30 instead of M15.

farizu,
did something for your strategy, obviously the definiton of "intertwine" is a problem here so what I did is to substract each MAs and take the trade if the difference is below a maximum number of Pips. This version is not positive, but check the trades it takes and give me feedback.

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

Postby farizu » Sun Nov 22, 2009 10:11 pm

newschool wrote:learning_fx,
I do not support anymore the Sema EA, but it very easy to change it to daily, just go in the source and change the PERIOD_H1 to PERIOD_D1. You can also change the Open price of the candles to something like M30 instead of M15.

farizu,
did something for your strategy, obviously the definiton of "intertwine" is a problem here so what I did is to substract each MAs and take the trade if the difference is below a maximum number of Pips. This version is not positive, but check the trades it takes and give me feedback.



Many many thanks newschool, will forward test this baby and get back to you soon.

There is another strategy that i am manual trading with very good success, I will try to set out the entry and exit criteria as succinctly as possible and post it here as soon as i can...

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 » Sun Nov 22, 2009 10:12 pm

Hey, I suggest you backward test first because like I said, I am not even sure the entries are exactly like you asked.

PINKPANTHER5
rank: 150+ posts
rank: 150+ posts
Posts: 216
Joined: Fri Feb 13, 2009 7:52 pm
Reputation: 0
Gender: None specified
Contact:

Re: I code your strategy into an EA

Postby PINKPANTHER5 » Sun Nov 22, 2009 10:40 pm

newschool wrote:Simply post the entry and exit triggers, I will then make an EA with the source in MQ4 available.

I do this because you will be able to automate your method, and at the same time it shares the knowledge of traders, turning small ideas in great strategies.



Here is an example blueprint you need to follow===

conditions for BUY:
Bid > Rsi20
AND Bid>MA50

close:
Bid = MA50
OR 3 red candles in a row





Newchool


Here is the code for the triggerline. Can you set the trigger, when the crossover buy and sell occurs? And hopefully have the stop-loss and take profit to be a changeable option....


//+------------------------------------------------------------------+
//| Trigger Line |
//| Copyright ? 2005 dwt5 and adoleh2000 |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005 dwt5 and adoleh2000 "
#property link "http://www.metaquotes.net/"

//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_color3 HotPink
#property indicator_color4 Aqua

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];

int width;

extern int Rperiod = 50;
extern int LSMA_Period = 50;
int Draw4HowLong;
int shift;
int i;
int j;
int loopbegin;
int length;
int lsma_length;

double lengthvar;
double tmp ;
double tmp2 ;
double wt[];
double sum[];
double lsma_sum[];
double lsma_ma[];
double middle[];
int c;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 7 additional buffers are used for counting.
IndicatorBuffers(7);

//---- drawing settings

SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);

SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);

SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);

SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1);



SetIndexBuffer(4,sum);
SetIndexBuffer(5,wt);
SetIndexBuffer(6,lsma_ma);

//---- initialization done
return(0);
}

int start()

{ Draw4HowLong = Bars-Rperiod - 5; //Rperiod = 20
length = Rperiod; //length now = 20
lsma_length = LSMA_Period;
loopbegin = Draw4HowLong - length - 1;


for(shift = loopbegin; shift >= 0; shift--) // MAIN For Loop
{
sum[1] = 0;
for(i = length; i >= 1 ; i--) //LSMA loop
{
lengthvar = length + 1; //lengthvar = 21
lengthvar /= 3; //lengthvar = 7
tmp = 0;
tmp = ( i - lengthvar)*Close[length-i+shift]; //tmp = 20 - 7 * close[20-i+shift]
sum[1]+=tmp;
}
wt[shift] = sum[1]*6/(length*(length+1));
j = shift;
lsma_ma[shift] = wt[j+1] + (wt[j]-wt[j+1])* 2/(lsma_length+1);


//========== COLOR CODING ===========================================


ExtMapBuffer1[shift] = wt[shift];
ExtMapBuffer2[shift] = lsma_ma[shift];
ExtMapBuffer3[shift] = wt[shift];
ExtMapBuffer4[shift] = lsma_ma[shift];



if (wt[shift] < lsma_ma[shift])
{
ExtMapBuffer4[shift] = EMPTY_VALUE;
ExtMapBuffer3[shift] = EMPTY_VALUE;
}

}
}
//+------------------------------------------------------------------+

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 Dec 01, 2009 12:24 am

Hi Newschool,

have been playing around with the ea and i think i have isolated why the ea is yet not as profitable as the manual system. If you look at the attached chart you will see that the ea is getting into the trades a little too late.

Can this be rectified?

Also can you please change the ea so that it allows fractional lots to be traded?

Many thanks for a brilliant first attempt at automating this strategy.
Attachments
28nov2.gif
28nov2.gif (17.47 KiB) Viewed 7611 times

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


Return to “MetaTrader”