Please check my first EA :)

 

I did up this EA based on the VQ indicator and called it from the EA with iCustom when VQ signals a Buy and Sell, did I do something wrong?

Files:
vq_1.mq4  8 kb
my_first_ea.mq4  10 kb
 

Doesn't seem to be trading

 

Anyone, please ?

 

//+------------------------------------------------------------------+

//| Variable Begin |

//+------------------------------------------------------------------+

double Buy1_1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 0, Current + 0);

double Sell1_1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 0, Current + 0);

these condition are same... or did I miss something?

Maybe you can explain further about your idea for this EA? I still don't get it.

 

//+------------------------------------------------------------------+

//| Signal Begin(Entry) |

//+------------------------------------------------------------------+

if (False) Order = SIGNAL_BUY;

if (False) Order = SIGNAL_SELL;

//+------------------------------------------------------------------+

//| Signal End |

//+------------------------------------------------------------------+

Also, no definitive criteria for order signal, the mq4 was generate from a template, ExpertAdvisorBuilder, just re-check variable and signal entry point.

 

Thanks for responding All I want is for the EA to look at the Indicator(s) and if it says to Buy then Buy and if it says Sell then Sell. Yes, as you can see I used a template and thought all I had to do was put the 'extern' values from the indicator into the Buy and Sell locations. They are the same because it is the same indicator and the indicator puts an Arrow on the chart when to Sell or Buy. Let me know if you need more info. I don't even know if what I want to do is possible the way I want it to work. Basically when the indicator signals Buy or Sell then I want the EA to see that and place the trade.

 

Hi, I've changed the code so that it enter trades. Two versions. One only trade when their is an up or down arrow (My first EA2) and the other one trades when the indicator moves upward so if previous trade was profitable or loss and VQ still moves up it will enter another buy trade. I hope this help.It isn't the best coding but then the EA is spagetti code.

Regards

Derik

Files:
 
derikb:
Hi, I've changed the code so that it enter trades. Two versions. One only trade when their is an up or down arrow (My first EA2) and the other one trades when the indicator moves upward so if previous trade was profitable or loss and VQ still moves up it will enter another buy trade. I hope this help.It isn't the best coding but then the EA is spagetti code.

Regards

Derik

Ok, thanks allot Two things;

1 - do I have to use the extra VQ indi you attached? can you post the mq4.

2 - I have four other indicators to add, did you make it simple for me to add the links in the EA to the other indicators?

Like if I wanted to add B Bands or something?

How would I change it to have the EA only trade when all four indicators agree at the same time?

Thanks again.

 

I think the VQ is the same. You must make sure that you compiled the VQ (ex4).

It is easy to add rules to the current code.

Say you want a MA cross:

double MA10 = iMAdouble iMA( string symbol, int timeframe, 50, int ma_shift, int ma_method, int applied_price, 0)

double MA11 = iMAdouble iMA( string symbol, int timeframe, 50, int ma_shift, int ma_method, int applied_price, 1)

double MA20 = iMAdouble iMA( string symbol, int timeframe, 200, int ma_shift, int ma_method, int applied_price, 0)

double MA21 = iMAdouble iMA( string symbol, int timeframe, 200, int ma_shift, int ma_method, int applied_price, 1)

add the above under the following code:

double Entry1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 0, 1);

double Entry2 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 0, 2);

double Up2 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 1, 2);

double Down2 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 2, 2);

Then add the following to the entry buy rule:

if (Up2==Down2 && Entry1>Entry2 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))

MA10>MA20 && MA11<M21 && all the other rules. This is a cross up entry.

The change that 4 indicators will be up at the same time will give a few trades. For instance the MA10>MA20 will give trades only when trend is up but a cross only happens every now and then. So use the trend instead of a cross....etc.

Hope this help.

Files:
vq.mq4  8 kb
 
derikb:
I think the VQ is the same. You must make sure that you compiled the VQ (ex4).

It is easy to add rules to the current code.

Say you want a MA cross:

double MA10 = iMAdouble iMA( string symbol, int timeframe, 50, int ma_shift, int ma_method, int applied_price, 0)

double MA11 = iMAdouble iMA( string symbol, int timeframe, 50, int ma_shift, int ma_method, int applied_price, 1)

double MA20 = iMAdouble iMA( string symbol, int timeframe, 200, int ma_shift, int ma_method, int applied_price, 0)

double MA21 = iMAdouble iMA( string symbol, int timeframe, 200, int ma_shift, int ma_method, int applied_price, 1)

add the above under the following code:

double Entry1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 0, 1);

double Entry2 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 0, 2);

double Up2 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 1, 2);

double Down2 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 2, 2);

Then add the following to the entry buy rule:

if (Up2==Down2 && Entry1>Entry2 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))

MA10>MA20 && MA11<M21 && all the other rules. This is a cross up entry.

The change that 4 indicators will be up at the same time will give a few trades. For instance the MA10>MA20 will give trades only when trend is up but a cross only happens every now and then. So use the trend instead of a cross....etc.

Hope this help.

Wow Ok lets say I wanted to add a indicator called QQEA, would I add;

double Entry1 = iCustom(NULL, 0, "QQEA",5,14,4.236, 0, 0);

double Entry2 = iCustom(NULL, 0, "QQEA",5,14,4.236, 0, 1);

under the VQ indicator? how do I know what Shift value to use (0-7)?

Then how would I modify the Buy rule to have VQ and QQEA when agree at the same time?

 

Will this work if I add?;

double VQ0 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 0,0);

double VQ1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 0,1);

double QQEA0 = iCustom(NULL, 0, "QQEA",5,14,4.236, 0, 0);

double QQEA1 = iCustom(NULL, 0, "QQEA",5,14,4.236, 0, 1);

[/code]

[code]

//Buy

if (VQ0>VQ1 && QQEA0>QQEA1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

if(!IsTrade) {

So when VQ and QQEA buy signal agree at the same time, place a Buy trade?

EDIT: Looks like a trade was placed but not when they both triggered a sell at the same time but just when both indicators are in a downward motion. How do I set it to only place the trade at the moment they signal and not later?

Files:
newea.jpg  178 kb
Reason: