Hi Sirs:
i try to use symbol_close of bars forward by using symbol_close[-X] (X means bar forward of X bars) but the issue is that i don't know the maximum X i can use in this case and i hope if the X exceeds the last bar on one chart , all value exceeds the last bar should set as the close of last bar.
ex: the 3rd K is calculating ....
K1 K2 K3 K4 K5 K6 (K6 is the last bar on chart)
symbol_close[-1] should be close of K4
symbol_close[-2] should be close of K5
symbol_close[-3] should be close of K6
symbol_close[-4] should also be "close of K6"
in this case , the last bar is K6 , if i set index as -4 then the error will be raised.
i try to write a multicharts function REFX(symbol_close, -X) and try to figure out the
maximum X i can set in this function without raising errors but I can't find a good solution of this.
Can you guys help on this issue? thanks.
-------------------------------------------------------------------
https://www.multicharts.com/traders-blog/?p=540
Access to any bar from a script – new keywords
2) Bars forward are not limited by zero, and are only limited by the end of the data series
---------------------------------------------------------------------
symbol_close usage problem [SOLVED]
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: symbol_close usage problem [SOLVED]
Hello xdtrader168,
You should avoid referencing future bars, which are not plotted on a chart yet:
You should avoid referencing future bars, which are not plotted on a chart yet:
Code: Select all
if Symbol_CurrentBar+20 < Symbol_Length then
Plot1(symbol_close[-20]);
-
- Posts: 2
- Joined: 20 Mar 2014