NexusFi: Find Your Edge


Home Menu

 





IV Rank Indicator


Discussion in EasyLanguage Programming

Updated
    1. trending_up 4,219 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 4 attachments




 
Search this Thread
  #1 (permalink)
a121e
Indonesia
 
Posts: 8 since Dec 2013
Thanks Given: 3
Thanks Received: 1

Hi,

I want to build Indicator IV rank but IV in TS sometimes have Zero Value or the value Spike so I want to Filter that but the indicator become error. Can anyone help me to fix this.

Thanks in advance.

My code now is :

inputs :
Length(252),
IVSpikeRatio(2);

variables:
IV(0),
IV1(0),
IVH(0),
IVL(0),
HL(0),
Rank(0);


IV = IVolatility;
IV1 = IV[1] * IVSPikeRatio; {Criteria for Spike IV}

If IV <= 0 then IV = IV[1]; {For Filtering the Zero Value IV}

//If IV >= IV1 then IV = IV[1]; {For Filtering Spike IV Value}


Plot1 (IV, !("IV ALL"));


IVH = Highest(IV,Length)[1];
IVL = Lowest(IV,Length)[1];

If (IVH - IVL) > 0 then Begin
HL = (IVH - IVL);
Rank = ((IV - IVL) / HL);
End
else Begin
Rank = 0;
End;

//Plot1 (IV1,"IV1");
Plot2 (IVH,"Highest");
Plot3 (IVL,"Lowest");
//Plot4 (IV,"IV");
Plot5 (Rank, "IV Rank 66");

SetPlotColor(2,Green);
SetPlotColor(3,Red);
//SetPlotColor(1,Yellow);
//SetPlotColor(4,Blue);
SetPlotColor(5,Blue);

My Problem is the spike filter result IV is Zero.


Attached Thumbnails
Click image for larger version

Name:	IV Zero.jpg
Views:	355
Size:	251.2 KB
ID:	234390   Click image for larger version

Name:	Zero IV Gone.jpg
Views:	325
Size:	261.2 KB
ID:	234391  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Airspace Collapses 18 Points to 15.5% While Hormuz …
Prediction Markets & Event Contracts
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
Iran Airspace Contract Surges to 33.5% as Project Freedo …
Prediction Markets & Event Contracts
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
Hungary Called for Magyar at 97pct, Ending 16-Year Orban …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
BERN ALGOS algo trading journal
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


a121e,

what is the exact error that you are facing with the code?

Regards,

ABCTG


Follow me on X Reply With Quote
  #4 (permalink)
a121e
Indonesia
 
Posts: 8 since Dec 2013
Thanks Given: 3
Thanks Received: 1

Hi ABCTG,

the problem is when I want to to filter the sudden spike IV the result is the IV become Zero.

I dont know why and how to fix that.


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

a121e,

I would suggest to start simple and just plot IV and IV1. What is the outcome of that?

 
Code
inputs :
IVSpikeRatio(2);

variables:
IV(0),
IV1(0);

IV = IVolatility;
IV1 = IV[1] * IVSPikeRatio; {Criteria for Spike IV}

If IV <= 0 then IV = IV[1]; {For Filtering the Zero Value IV}

Plot1 (IV, "IV" );
Plot2 (IV1 , "IV1" );
If this is giving you what you want, great, add the spike filter. What is the outcome now?

 
Code
inputs :
IVSpikeRatio(2);

variables:
IV(0),
IV1(0);

IV = IVolatility;
IV1 = IV[1] * IVSPikeRatio; {Criteria for Spike IV}

If IV <= 0 then IV = IV[1]; {For Filtering the Zero Value IV}
If IV >= IV1 then IV = IV[1]; {For Filtering Spike IV Value}

Plot1 (IV, "IV" );
Plot2 (IV1 , "IV1" );
Post the screenshots for the two outcomes.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #6 (permalink)
a121e
Indonesia
 
Posts: 8 since Dec 2013
Thanks Given: 3
Thanks Received: 1

Hi ABCTG,

The result is :

For the zero IV is gone but the spike is still there and the second Code give result Zero value.

Regards,
Arie


Attached Thumbnails
Click image for larger version

Name:	Result.jpg
Views:	317
Size:	264.1 KB
ID:	234480  
Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

a121e,

what will be the value for IV[1] on the very first bar that you compute your code? Think about what this will result in with your code.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #8 (permalink)
a121e
Indonesia
 
Posts: 8 since Dec 2013
Thanks Given: 3
Thanks Received: 1

Hi ABCTG,

I think the result is zero.

I Guess I solve the problem even I dont know why the problem is finished. It Looks like suddenly works.

The final is like in the picture, the Zero IV and the Spike IV is gone.

the code is :

inputs :
IVSpikeRatio(2);

variables:
IV(0),
IV1(0),
IVSpike(0);

IV = IVolatility;
IVSPike = IV[1] * IVSPikeRatio; {Criteria for Spike IV}

If IV <= 0 then IV = IV[1]; {For Filtering the Zero Value IV}

//Filter for Spike
If IV >= IVSpike then
Begin
IV1 = IV[1];
End
Else
Begin
IV1 = IV;
End;

Plot1 (IV1, "IV Filter" );



Thanks for your guidance ABCTG

Regards,
Arie


Attached Thumbnails
Click image for larger version

Name:	Picture 01.JPG
Views:	324
Size:	158.6 KB
ID:	234486  
Reply With Quote
Thanked by:
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

a121e,

I think so, too.

IV[1] could simply be 0 on the first bar. This results in "IVSPike = IV[1] * IVSPikeRatio;" being zero as well
and with "If IV <= 0 then IV = IV[1];" you make IV = 0, too.
Therefore on the next bar IV[1] will be 0 again and your code simply created a situation where you keep setting IV to 0.

I am glad to hear that you got it working.

Regards,

ABCTG


Follow me on X Reply With Quote




Last Updated on May 21, 2017


© 2026 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 - Downloads - Top
no new posts