Exploration for HH & LL

Dear Members,

I tried the below AFL based on the formula given by Mr.Modhelius in TradingView

Source Code;
res = ((baseSymbol/baseSymbol[lenght])/(comparativeSymbol/comparativeSymbol[lenght]) - 1)

Is it possible to add exploration column to find out if "res" is making higher highs or Lower Lows?

//Relative Strength
res = (Ref(C,1) / Ref(C,-55)) / (Ref(Foreign("Nifty 50","C"),1) / Ref(Foreign("Nifty 50","C"),-55)) -1 ;
Filter=1;
AddColumn (res,"RS-55",1.2);

Thank you

First you should realize that upper Ref() call looks into future!
Instead you should look back Ref(C,-1).

Secondly your res equation has lots of over-complication.

It can be written like this

frg_price= Foreign("Nifty50","C");
res = Ref(C/frg_price,-1) * Ref(frg_price/C,-55) -1;

-> Division by multiplying a reciprocal

(BTW, are you sure your ticker is "Nifty 50"? Tickers don't have space).


As for higher highs / lower lows e.g. you may use HHV() and LLV() functions.

@amisur,

What have you tried?

Go back to basics and learn how to find the Highest High value of something simple like the High value of the last few bars. That should lead you to what you need.

Thank you for correcting my mistake. I should look back Ref(c,-1)

"Nifty 50" is not ticker, Its the symbol for Index

AB is smart :slight_smile:
Conventionally, symbols don't have spaces but the Indices on NSE do have spaces and when such data is imported, it works out of the box.
Data vendors sometimes use the alternate name without spaces when streaming RTD.

Yes, IB symbols may have spaces too.

E.g. options

XXXX  200501C00155000-SMART-OPT

or future symbols.

Just not being a fan of spaces.