Easy for you , but hard for me :( PLEASE help :)

#1
Hello smart people, I have an easy question please and would like your help.
I am trying to have a % distance between two moving averages.

The code it not working, so I have done it incorrectly. Could you please correct me, please.

ma15 = ma(c,15);
ma62 = MA(c,62);

percentchangema = ((ma62 - ma15)/ ma15)*100;
Cond1ma = percentchangema > 5 ;// moving averages seperated by 5%

///So the distance between ma15 = ma(c,15) AND ma62 = MA(c,62) SHOULD be 5%
 

LoneWolf

Well-Known Member
#2
Hello smart people, I have an easy question please and would like your help.
I am trying to have a % distance between two moving averages.

The code it not working, so I have done it incorrectly. Could you please correct me, please.

ma15 = ma(c,15);
ma62 = MA(c,62);

percentchangema = ((ma62 - ma15)/ ma15)*100;
Cond1ma = percentchangema > 5 ;// moving averages seperated by 5%

///So the distance between ma15 = ma(c,15) AND ma62 = MA(c,62) SHOULD be 5%
First of all you need to take absolute value of the difference. Cause in bullish market when MA15 will be greater than MA62, you will get negative value and it wont be greater than 5. So use abs() function.

Secondly do you always need MA15 as the base price for percentage calculation ? Or base price need to be the price of the scrip ?
 
#3
Hello, thanks for replying.

Yes I would like to have the MA as the base price Percentage, because I want to have a difference in percentage value between two moving averages.

I hope that sounds right, i'm looking everywhere but not certain on how to do this. Your help will really go far please.
 

LoneWolf

Well-Known Member
#4
Hello, thanks for replying.

Yes I would like to have the MA as the base price Percentage, because I want to have a difference in percentage value between two moving averages.

I hope that sounds right, i'm looking everywhere but not certain on how to do this. Your help will really go far please.
Great. go ahead and try your hands with abs function. let me know if you need anything further..
 

Similar threads