Experts: Crossing of two iMA

 

Crossing of two iMA:

Crossover of two iMAs (Moving Averages), one more iMA (Moving Average) is used as the filter. Lot: manual or risk percent of balance. Stop, Market or Limit orders. The EA also sets Stop Loss, Take Profit, Trailing Stop.

Author: Vladimir Karputov

 

Mr.Vladimir,


could you add the option in trailing stop to move from "entrace" or "bottom" ?


for axemple:


the function "trailing"

void Trailing()

the suggest change to it

input bool         InpTrailingtoEntrance   = false;           // Trailing to Entrace (or to bottom)


calling it..
if you want to move from bottom/stoploss
Trailing(false)

if you want to move to entrace operation
Trailing(true)


void Trailing(bool Move_to_entrace=true))

Crossing of two iMA
Crossing of two iMA
  • votes: 19
  • 2017.08.10
  • Vladimir Karputov
  • www.mql5.com
Crossover of two iMAs (Moving Averages), one more iMA (Moving Average) is used as the filter. Position Lot calculation: manually or risk percent of balance. Trading method: Stop, Market or Limit orders. "Parameters of the first Moving Average"; "Parameters of the second Moving Average"; "Parameters of the Third Moving Average"; Third...
 
zemo :

...

could you add the option in trailing stop to move from "entrace" or "bottom" ?

...


I do not understand.

 
Vladimir Karputov:

I do not understand.


trailing stop with step.

if you use...


(1) the "normal" trailing  when reached move the "stop" to ENTRACE  


(2) the "another" trailing when reached move the "stop" from STOPLOSS..

====example (1)  move stoploss to entrance

trailing_stop 02 points
trailing_step 01 points
stoploss = 10 points

- buy at 110 (entrance point)
- after few minutes , price moved to 12  (and trailing stop is reached)
  .: (new stop loss is...)
  stoploss=110  (=the value of entrance point)

====example (2) move stoploss from bottom

trailing_stop 02 points
trailing_step 01 points

stoploss = 10 points

- buy at 110 (entrance point)
- after few minutes , price moved to 112  (and trailing stop is reached)
  .: (new stop loss is...)
  stoploss=101 (= stoploss+trailing_step )  100+1= result 101


now price moves to 12  (and trailing stop is reached again)
  .: (new stop loss is)
 stoploss=102  (= stoploss+trailing_step )  101+1= result 102

 
zemo :

trailing stop with step.

if you use...


(1) the "normal" trailing  when reached move the "stop" to ENTRACE  


(2) the "another" trailing when reached move the "stop" from STOPLOSS..

====example (1)  move stoploss to entrance

trailing_stop 02 points
trailing_step 01 points
stoploss = 10 points

- buy at 110 (entrance point)
- after few minutes , price moved to 12  (and trailing stop is reached)
  .: (new stop loss is...)
  stoploss=110  (=the value of entrance point)

====example (2) move stoploss from bottom

trailing_stop 02 points
trailing_step 01 points

stoploss = 10 points

- buy at 110 (entrance point)
- after few minutes , price moved to 112  (and trailing stop is reached)
  .: (new stop loss is...)
  stoploss=101 (= stoploss+trailing_step )  100+1= result 101


now price moves to 12  (and trailing stop is reached again)
  .: (new stop loss is)
 stoploss=102  (= stoploss+trailing_step )  101+1= result 102

I do not understand you.

The code uses trailing with the following steps:

  • Trailing Stop ("0" -> not trailing)
  • Trailing Step (use if Trailing Stop >0)
 

hello,

could you please check if it would be easy for your to modify your EA in order to get a behaviour like shown on this chart:

Picture


you should see the 3 MA's: once the shortest crosses the longest low to high a LONG position is opened. The intermediate MA is used to close the position.
Same for SHORT position.


Please check and reply if you can. 

thanks

IDP

 
italoumberto :

hello,

could you please check if it would be easy for your to modify your EA in order to get a behaviour like shown on this chart:



you should see the 3 MA's: once the shortest crosses the longest low to high a LONG position is opened. The intermediate MA is used to close the position.
Same for SHORT position.


Please check and reply if you can. 

thanks

IDP


On your picture there are two "Open Long". And each of them is open for different signals.

So the answer is: the description is bad. I'm not going to do anything about this picture.

 
Vladimir Karputov:

On your picture there are two "Open Long". And each of them is open for different signals.

So the answer is: the description is bad. I'm not going to do anything about this picture.


Hei Vladimir,
thanks for reading the message. I can explain. From the left to the right: you see the first LONG is opened when the shortest MA crosses the longest, then you see this position is closed when (close LONG) the shortest close the medium MA (which is used to close the positions indeed). Then the short MA crosses again upward the medium MA (while is still above the longest) and a LONG position is opened again.... and so on.

I do not ask you to do anything at this stage I just want please have your opinion on the possibility to modify/adapt your EA to this strategy. I'm asking since your EA deals with 3 MA like my strategy.

Thanks

italoumberto

 
italoumberto :

Hei Vladimir,
thanks for reading the message. I can explain. From the left to the right: you see the first LONG is opened when the shortest MA crosses the longest, then you see this position is closed when (close LONG) the shortest close the medium MA (which is used to close the positions indeed). Then the short MA crosses again upward the medium MA (while is still above the longest) and a LONG position is opened again.... and so on.

I do not ask you to do anything at this stage I just want please have your opinion on the possibility to modify/adapt your EA to this strategy. I'm asking since your EA deals with 3 MA like my strategy.

Thanks

italoumberto

You can do anything, anything. Moreover, my adviser can be used as a basis (as a skeleton, as a template).

The main thing: it is first to formally state the signals (describe the algorithm):

  • BUY open
  • BUY close
  • SELL open
  • SELL close
 
Vladimir Karputov:

You can do anything, anything. Moreover, my adviser can be used as a basis (as a skeleton, as a template).

The main thing: it is first to formally state the signals (describe the algorithm):

  • BUY open
  • BUY close
  • SELL open
  • SELL close

OK,

thank you very much for your quick response. I gonna try to read carefully your code and possibly come back to you with more defined specs as you mentioned.

italoumberto

 

Hello Sir,


Many thanks for this great work Vladimir, you are amazing. I started coding and I hope to reach such a level in the near future.


Regarding the cross of 2 iMAs I would like to add a value to the value calculated for the iMAs.

Do you know how can I do that? 

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.


Thanks much for your help. 

Once that is done I might try to set up a stop loss to the previous low/high. 


AD