Scan periodicity switch using Range bars

Hi,

I am not much of a coder. Over the course of my usage, I have zeroed on using range bars for my system. I would appreciate if anyone could guide me as to how to define a universal scan periodicity for all the stocks in my watchlist with range bars being time-independent.

A couple of examples I am using right now:
NIFTY - 160R
BANKNIFTY - 200R
RELIANCE - 30R

Would it be possible to scan all the aforementioned stocks at their defined range periodicity under a single scan?

Single scan uses single periodicity. However, instead of trying to change the periodicity, you should define the "RANGE" individually on per-symbol basis.

As per documentation
https://www.amibroker.com/kb/2014/09/19/how-to-display-range-bars/

The "R" in range bars represents single TickSize move. So instead of trying to change the periodicity you should adjust TickSize in each symbol respectively and then you will be able to use single periodicity.
Let us assume that now you have TickSize set to 0.01 in every security, so
NIFTY 160R represents 1.6 move
BANKNIFTY 200R represents 2.0 move
RELIANCE 30R represents 0.3 move

With that in mind you should change ticksize for those symbols to:
NIFTY 1.6
BANKNIFTY 2.0
RELIANCE 0.3

Then you will be able to use constant range 1R

Alternatively you can use TickSizes of 0.016, 0.02 and 0.003 and use 100R range setting.

4 Likes

Thank you Tomasz for the prompt response. That helped my issue. Once again, thank you

My last post on a similar topic has been closed by admin. The original post has answered and served my query

Link to the original post:
https://forum.amibroker.com/t/scan-periodicity-switch-using-range-bars/13819

While defining the "RANGE" individually on per-symbol basis has solved my need in having a uniform scan interval of 1R, I am facing difficulty in defining a "Range/tick size" at a symbol level for options contracts. As the option pricing is quite dynamic, I tried using a dynamic variable with the tick size being dertermined by the Close price of a particular option. The tick size seems to be working as per the range acertained by the dynamic variable in the exploration. The scan results however, are revert back to 0 tick size.

The sample code is as below:

dynvalue = IIf(C>=1400 AND C <1500,3.25,IIf(C>=1400 AND C < 1200, 2.5, IIf(C>=1200 AND C<1100, 1.75, .05)));
TickSize = dynvalue;

AddColumn(C, "Close");
AddColumn(dynvalue,"dynvalue");
AddColumn(TickSize,"TickSize");
Filter = 1;

Attached screen shot showing exploration result of tick size carrying dynamic value defined. But scan result showing as default 0 tixk size. Would highly appreciate it if someone guides me to the right side35

You are NOT reading what was written to you.

Precision is a key word.

No-one told you to write that in AFL code. That is WRONG.

Instead of "inventing" things you should DIRECTLY AND PRECISELY FOLLOW what is written here: https://www.amibroker.com/kb/2014/09/19/how-to-display-range-bars/

To display range charts, first you need to specify the TickSize in the Symbol–>Information window.

Exactly that. Do what it is written instead of "inventing" things.

To use Range Bars you MUST enter the TickSize in the Symbol–>Information window. NOT in AFL formula. TickSize is a per-symbol CONSTANT, scalar value, NOT array and DOES NOT change with close price over the time.

1 Like