NexusFi: Find Your Edge


Home Menu

 





MACD Percentile


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,670 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

MACD Percentile

  #1 (permalink)
 ilu007 
New York + US
 
Experience: Intermediate
Platform: MultiCharts
Trading: Indian Stocks
Posts: 37 since Aug 2015
Thanks Given: 10
Thanks Received: 2

Dear Coders,

I'm looking to use Percentile and Percent rank indicators on MACD ..

Please refer to the print screen below

Screenshot by Lightshot

I know Percentile and Percent Rank both are in built function in EL but I'm not able to figure out to use it effectively.

Can anyone help me with this?

Appreciate your soonest response

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NexusFi Journal Challenge - May 2024
Feedback and Announcements
REcommedations for programming help
Sierra Chart
Quant vue
Trading Reviews and Vendors
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


ilu007,

the screenshot is to small to see anything meaningful. What exactly seems to be the problem you are running into?
You could post the code that is giving you issues, so we can see what might be wrong with it.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
 ilu007 
New York + US
 
Experience: Intermediate
Platform: MultiCharts
Trading: Indian Stocks
Posts: 37 since Aug 2015
Thanks Given: 10
Thanks Received: 2

Dear ABCTG,

Thank you for your reply..

I'm finding difficulty in coding the percentile rank function in EL...

What I would like to have is :

I would like to have a LookBack Period of the Highs and Lows and plotting lines at 90% of those levels and color coding the Histogram when it exceeded the 90 Percentile of the Highs or Lows of the LookBack period which I call the Threshold Lines. If that condition is TRUE for MACD I found the optimal entry was when the Histogram crossed the 50% level of the ZERO line and the Threshold lines, So I created a rule that plots a Visual Cross. Therefore we have to filterout the signals by waiting for the Histogram to Exceed the 90th Percentile of the LookBack period, then waiting for a confirmation of the reversal by waiting for the Histogram to cross the Mid-Threshold line.

There are two lower indicators.. May this screenshot will be visible for you

Screenshot by Lightshot

I can have those indicators coded in Trade Navigator as well which is

MACD Highest High Percentile
Highest (MACD (Close , Fast Period , Slow Period , False) , LookBack) * (Percentile / 100)

MACD Lowest Low Percentile
Lowest (MACD (Close , Fast Period , Slow Period , False) , LookBack) * ((100 - Percentile) / 100)

MACD Percent Rank
Percentile Rank (MACD (Close , Fast Period , Slow Period , False) , LB_Prd , True , False)

MACD PercentRank_HT
Percentile Rank (MACD (Close , Fast Period , Slow Period , False) , LB_Prd , True , False) > HT Pct

MACD percent Rank_LT
Percentile Rank (MACD (Close , Fast Period , Slow Period , False) , LB_Prd , True , False) < LT Pct

Started this thread Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

Hi ilu007,

why do you need the percentile rank function at all?
Assuming "Percentile" is an input, you already have the thresholds lines computed with this
 
Code
Highest (MACD (Close , Fast Period , Slow Period , False) , LookBack) * (Percentile / 100) 

Lowest (MACD (Close , Fast Period , Slow Period , False) , LookBack) * ((100 - Percentile) / 100)
Then you can just check for your cross over conditions and you should be good to go.

Regards,

ABCTG



ilu007 View Post
Dear ABCTG,

Thank you for your reply..

I'm finding difficulty in coding the percentile rank function in EL...

What I would like to have is :

I would like to have a LookBack Period of the Highs and Lows and plotting lines at 90% of those levels and color coding the Histogram when it exceeded the 90 Percentile of the Highs or Lows of the LookBack period which I call the Threshold Lines. If that condition is TRUE for MACD I found the optimal entry was when the Histogram crossed the 50% level of the ZERO line and the Threshold lines, So I created a rule that plots a Visual Cross. Therefore we have to filterout the signals by waiting for the Histogram to Exceed the 90th Percentile of the LookBack period, then waiting for a confirmation of the reversal by waiting for the Histogram to cross the Mid-Threshold line.

There are two lower indicators.. May this screenshot will be visible for you

Screenshot by Lightshot

I can have those indicators coded in Trade Navigator as well which is

MACD Highest High Percentile
Highest (MACD (Close , Fast Period , Slow Period , False) , LookBack) * (Percentile / 100)

MACD Lowest Low Percentile
Lowest (MACD (Close , Fast Period , Slow Period , False) , LookBack) * ((100 - Percentile) / 100)

MACD Percent Rank
Percentile Rank (MACD (Close , Fast Period , Slow Period , False) , LB_Prd , True , False)

MACD PercentRank_HT
Percentile Rank (MACD (Close , Fast Period , Slow Period , False) , LB_Prd , True , False) > HT Pct

MACD percent Rank_LT
Percentile Rank (MACD (Close , Fast Period , Slow Period , False) , LB_Prd , True , False) < LT Pct


Follow me on Twitter Reply With Quote
  #6 (permalink)
 ilu007 
New York + US
 
Experience: Intermediate
Platform: MultiCharts
Trading: Indian Stocks
Posts: 37 since Aug 2015
Thanks Given: 10
Thanks Received: 2

Dear ABCTG,

Thank you for your input...

I have coded an indicator based upon your code but it is giving me some kind of error...

Here is the code

inputs:
FastLength( 12 ),
SlowLength( 26 ),
MACDLength( 9 ) ,
LookBack(100);


variables: var0( 0 ),
var1( 0 ),
var2( 0 ),
HighPrct(0),
LowPrct(0);

var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
HighPrct = Highest (MACD (Close , FastLength , SlowLength, False) , LookBack) * (Percentile / 100);
LowPrct = Lowest (MACD (Close, FastLength, SlowLength, False), LookBack) * ((100 - Percentile / 100));


Plot1( var0, "MACD" ) ;
Plot2( var1, "MACDAvg" ) ;
Plot3( var2, "MACDDiff" ) ;
Plot4( 0, "ZeroLine" ) ;
Plot5(HighPrct, "LoPrct");
Plot6(LowPrct, "HiPrct");




Will it be possible to correct this....

Started this thread Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

ilu007,

most likely it will be, but without an error description it's hard to tell you what to correct.
My guess is that you need to get rid of the boolean input for the MACD function, as it only needs three.

Instead of calling the same function three times, you could as well just use the var0 as input for the Highest/Lowest function directly.

Regards,

ABCTG


ilu007 View Post
Dear ABCTG,

Thank you for your input...

I have coded an indicator based upon your code but it is giving me some kind of error...

Here is the code

inputs:
FastLength( 12 ),
SlowLength( 26 ),
MACDLength( 9 ) ,
LookBack(100);


variables: var0( 0 ),
var1( 0 ),
var2( 0 ),
HighPrct(0),
LowPrct(0);

var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
HighPrct = Highest (MACD (Close , FastLength , SlowLength, False) , LookBack) * (Percentile / 100);
LowPrct = Lowest (MACD (Close, FastLength, SlowLength, False), LookBack) * ((100 - Percentile / 100));


Plot1( var0, "MACD" ) ;
Plot2( var1, "MACDAvg" ) ;
Plot3( var2, "MACDDiff" ) ;
Plot4( 0, "ZeroLine" ) ;
Plot5(HighPrct, "LoPrct");
Plot6(LowPrct, "HiPrct");




Will it be possible to correct this....


Follow me on Twitter Reply With Quote




Last Updated on November 17, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts