Experts: Crossing of two iMA - page 2

 
Antoine Djondo :

***

For example if the moving average value is v=1000 I would like to code it such as it gives me v+2. 2 being the number of unit I would like to add to the price or value of the moving average.

***

I do not understand what the meaning is. Who is '1000', who is 'v + 2.2'?

 

Thank for your answer.

Sorry, let me clarify.


I would like to know if when the EA calculates the value of the iMA, I can set a parameter to add or deduct "x" to the value of the iMA.


I was thinking it has to with the handle of the indicator (handle_iMA_First) or the iCustom for the indicator. 

It would help me make my strategy more efficient because the EA takes some trades when the moving averages crosses but it's actually losing setups. 

For example on the screenshot you can see the EMA(8) value is lower than the SMA(18) so the EA took the sell but I want to be able to add the number 1 to the EMA(8) value of 33047.587 to increase it to 33048.587 and potentially prevent it from taking the sell.


thank you for your help.


Let me know if you want the whole quote.  

 

Using the code example Intersection 2 iMA Choosing Strategies - you need to enter the parameter ' Minimum Intersection height '.

Intersection 2 iMA Choosing Strategies
Intersection 2 iMA Choosing Strategies
  • www.mql5.com
Торговля на пересечении двух iMA (Moving Average, MA). Выбор из нескольких стратегий для открытия
 

Or here's some more code: iMA Minimum Intersection Height:

iMA Minimum Intersection Height

 

Thank you so much Vladimir, it's great, I added the code for the parameter minimum height intersection to the initial "Crossing of 2 iMAs" code.

The one without the intersection parameter is making more money on the same test period but the payoff per trade is less, so I'm trying to understand why the intersection one is not taking some trades...

I attached the mq5 files for each and the reports so you can check it out if you want.


The last thing I'm trying to do is to allow user to set the stop loss to the previous high (for sell) or previous low (for buy).

I'm thinking of using either iLow/iHigh or copyLow/CopyHigh. If you have any idea it would help me a lot, I think after that it will be ready.


Respect.


AD

 

Posts not in English have been removed.

This is an English language forum, please only post in English.

 

When I add the EA to the chart it disappears immediately. what should i do to solve this problem?

 
Tiofelo Teles :

When I add the EA to the chart it disappears immediately. what should i do to solve this problem?

Check two log files: the "Experts" tab and the "Journal" tab.

 

Hello Vladimir, 


I would like to add the possibility to close any trade on the opposite crossing. 

Could you help me with that please? 


Thanks

 
Antoine Richard Ayao Mawuena Djondo :


For this you need to decide what is "opposite crossing".

Reason: