Synthetic Currency MT4 indicator Codding Help Needs

 

Hey Guys,

I need help for codding indicator for MT4, what I need is to create a indcator for synthetic currency with th folowing calculation:

(currency symbol1+currency symbol2)/(currency symbo1-currency symbol2)

is it possible?

The mathematical algorithm of the above indicator line is:

synthetic currency = (x+y)/(x-y)

whwre x = currency symbol1

where y = currency symbol2

Please help

Tank you all

 
stoyanx:
Hey Guys,

I need help for codding indicator for MT4, what I need is to create a indcator for synthetic currency with th folowing calculation:

(currency symbol1+currency symbol2)/(currency symbo1-currency symbol2)

is it possible?

The mathematical algorithm of the above indicator line is:

synthetic currency = (x+y)/(x-y)

whwre x = currency symbol1

where y = currency symbol2

Please help

Tank you all

Assuming that you use a standard loop way in the indicator, all you have to do is the following :

double x=iMA(symbol1,0,1,0,MODE_SMA,Price,iBarShift(symbol1,0,Time));

double y=iMA(symbol2,0,1,0,MODE_SMA,Price,iBarShift(symbol2,0,Time));

if (x!=y)

bufferValue = (x+y)/(x-y);

else bufferValue = 0;

and you will get those values calculated

 

Dear Mladen, thank you for your help,

However I am not a programer and have no idea how to create and indicator with the code ou provide, can you please let me know how to do this, is it possible to paste this php code in to the mql4 code? Thanks again fo your help

 
stoyanx:
Dear Mladen, thank you for your help, However I am not a programer and have no idea how to create and indicator with the code ou provide, can you please let me know how to do this, is it possible to paste this php code in to the mql4 code? Thanks again fo your help

stoyanx

Here you go : synthetic_currency.mq4

Files:
 
stoyanx:
Hey Guys,

I need help for codding indicator for MT4, what I need is to create a indcator for synthetic currency with th folowing calculation:

(currency symbol1+currency symbol2)/(currency symbo1-currency symbol2)

is it possible?

The mathematical algorithm of the above indicator line is:

synthetic currency = (x+y)/(x-y)

whwre x = currency symbol1

where y = currency symbol2

Please help

Tank you all

stoyanx

How do you use that in trading?

Reason: