TradingView
RozaniGhani-RG
2023年4月9日早上8點47分

Zigzag Array Experimental 

Crude Palm Oil FuturesMYX

描述

This is experimental script for zigzag which uses type, method and array. Not recommend for actual usage, for pine script study maybe useful.

In this experiment, I use type as coded below. It seems have limitation as specially when push as array. As Trading View recommendation, pushing float and int into array especially for type not guarantee to work. I agree with that. Preferred to push array as line or label especially for types.

// @type Used for point especially for array // @field x int value for bar_index // @field y float value for price // @field sty label style // @field col color for text label // @field str high or low string type point int x = na float y = na string sty = na color col = na string str = na


I simulate the arrays as below.
var dirLine = array.new<line>() var dirLabel = array.new<label>() var dirPoint = array.new<point>() .... dirPoint.unshift(zigzag.createPoint(0)) dirLabel.unshift(zigzag.createLabel(fontSize, 0, true)) dirLine.unshift(zigzag.createLine(width, switchLine, 0, true))


Here are some results.







評論
nellaicloud4soft
Thanks for this nice script. Could you enhance it to watch the pivot points for 20 tickers and 2 timeframe.
RozaniGhani-RG
@nellaicloud4soft, great idea. Surely i will do in future.
Henk_Idiogenes
Thanks for contributing the script. Why do you write "Not recommend for actual usage"? Thanks.
Arun_K_Bhaskar
Please provide a code example to get specific value of any row. Suppose if i need the 3rd price value how to get it. Thanks in advance.
juiida
how to get the actual bar index ? is there any trick in your mind?
juiida
@juiida, solved the matter .. thanks
RozaniGhani-RG
@juiida, glad you figure it out. thank you.
just_naba
great , bar index is the total of vol ?
RozaniGhani-RG
@naba_naif, bar_index is the position where HL is found.
just_naba
@RozaniGhani-RG, found depends in what ?
更多