How to get Ratio of 2 Moving averages - page 2

 
Vladimir Karputov #:

Example: Very Simple Intersection iMA Open Position

I actually do know how to create iMA handles and get values for them. I also coded the EA I wanted. I then incorporated your code for "Difference of Two iMA Formula" indicator into my code. Works well.
Then I realized, I needed to use the values of the "Difference of Two iMA Formula" indicator line to close trades. But this is a custom indicator so I don't know how to manipulate.
 Attached is a link to your custom indicator in question. (https://c.mql5.com/3/384/Difference_Two_iMA_Formula.mq5)
Below is a screenshot of the Custom indicator in action and the formula I chose here is the "F_1" option or the "fast/slow" . You can see the difference between the Two iMAs in the attached screenshot is 0.00000. Now, I want to use this "0.00000" to close positions. Like if value exceeds "0.00000", close trade. Or For instance like if difference of the 2 iMAs is greater than 0, close trade .
 I think I haven't been explaining my problem clearly in the previous comments. I apologize.



Files:
 
Seleucus # :
I actually do know how to create iMA handles and get values for them. I also coded the EA I wanted. I then incorporated your code for "Difference of Two iMA Formula" indicator into my code. Works well.
Then I realized, I needed to use the values of the "Difference of Two iMA Formula" indicator line to close trades. But this is a custom indicator so I don't know how to manipulate.
 Attached is a link to your custom indicator in question. ( https://c.mql5.com/3/384/Difference_Two_iMA_Formula.mq5 )
Below is a screenshot of the Custom indicator in action and the formula I chose here is the "F_1" option or the "fast/slow" . You can see the difference between the Two iMAs in the attached screenshot is 0.00000. Now, I want to use this "0.00000" to close positions. Like if value exceeds "0.00000", close trade. Or For instance like if difference of the 2 iMAs is greater than 0, close trade .
 I think I haven't been explaining my problem clearly in the previous comments. I apologize.

Do you need an example of working with a custom indicator? Then you need to use the iCustom function to create the handle.

 
Vladimir Karputov #:

Do you need an example of working with a custom indicator? Then you need to use the iCustom function to create the handle.

I'm lost. I read up on how to use the iCustom () but most of the examples I saw only have 3 input parameters. I'm trying to use values of the Two iMA Formula custom indicator you showed me. It has 9 input parameters. I filled them in the iCustom (...) that I created in my EA . When I compile and test in the strategy tester I get two errors. Cannot load indicator'moving average' [4002] and failed to create handle of the iMA ('fast') error code 4002.

This is how I filled in the parameters iCustom

double ratioFastToSlow=iCustom(Symbol), Period (), IndicatorName, Inp_MA_Fast_ma period, Inp_MA_Fast_ma_shift, Inp_MA_Fast_ma_method, Inp_MA_Fast_applied_price, Inp_MA_Slow_ma_period, Inp_MA_Slow_ma_shift, Inp_MA_Slow_ma_method, Inp_MA_Slow_applied_price, f_1);


Do give me feedback on how I can make it work 
 
Seleucus # :
I'm lost. I read up on how to use the iCustom () but most of the examples I saw only have 3 input parameters. I'm trying to use values of the Two iMA Formula custom indicator you showed me. It has 9 input parameters. I filled them in the iCustom (...) that I created in my EA . When I compile and test in the strategy tester I get two errors. Cannot load indicator'moving average' [4002] and failed to create handle of the iMA ('fast') error code 4002.

This is how I filled in the parameters iCustom



Do give me feedback on how I can make it work 

If you have a question about an indicator that is published in CodeBase - please ask your question in a special discussion topic for this indicator (each code from CodeBase has its own special discussion page).

 
Vladimir Karputov #:

If you have a question about an indicator that is published in CodeBase - please ask your question in a special discussion topic for this indicator (each code from CodeBase has its own special discussion page).

I'm new to this and didn't know there are different pages for different  topics. secondly since you are the author of this custom indicator. https://www.mql5.com/en/code/38978 please show me with an example how to get values from your custom indicator. I can create a handle for it and call it using iCustom but getting values from it has been a headache. I have scoured through pages of people asking similar stuff but none of their examples or solutions they got has helped. I have also read documentation in the links you have been attaching. I have gained lots of insight but ultimately they have yielded nothing.  just show me an example based on this specific custom indicator since I feel this is a unique indicator you coded and other examples out there just aren't similar.  

Two iMA Formula
Two iMA Formula
  • www.mql5.com
Study of the dependencies of two iMA (Moving Average, MA)
 
Seleucus # :

I'm new to this and didn't know there are different pages for different  topics. secondly since you are the author of this custom indicator.  https://www.mql5.com/en/code/38978 please show me with an example how to get values from your custom indicator. I can create a handle for it and call it using iCustom but getting values from it has been a headache. I have scoured through pages of people asking similar stuff but none of their examples or solutions they got has helped. I have also read documentation in the links you have been attaching. I have gained lots of insight but ultimately they have yielded nothing.  just show me an example based on this specific custom indicator since I feel this is a unique indicator you coded and other examples out there just aren't similar.  

I posted an example.

 
Vladimir Karputov #:

I posted an example.

Thanks for all the help and advice Vladimir. I was able to get it to work eventually. 
Reason: