Hi,
is there a possibility to project indicators in the future beyond the lastbar on chart without using positive or negative displace ?
I ask this because I'm trying to create a cyclical indicator which projects in the future an hypotetical trend of the market, but I can't plot it beyond the last bar even if its creation doesn't depend on any data in the chart (NOT used open, high, low, close, volume ecc...) . It's a sinewave indicator which starts in a given date and time and moves on in the same way in the future respecting the parameters of lenght and slope given in the inputs panel.
Attached there is a snapshot of what I'm trying to create and then what I've seen on the web using Metastock (the same indicator but maybe with a projection beyond lastbar on chart).
Is there the possibility to project this indicator not only to the last bar on chart, but for example to the maxbarsforward ??
Thank
CraZy
Powerlanguage and projection in the future
- CrazyNasdaq
- Posts: 322
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 90 times
Powerlanguage and projection in the future
- Attachments
-
- Cyclical Multicharts.png
- My indicator using Multicharts
- (86.54 KiB) Downloaded 1980 times
-
- Cyclical Metastock1.png
- First Snapshot from Metastock
- (111.38 KiB) Downloaded 1966 times
-
- Cyclical Metastock2.png
- Second snapshot from Metastock
- (136.17 KiB) Downloaded 1975 times
- TJ
- Posts: 7746
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2225 times
Re: Powerlanguage and projection in the future
it can be done...Hi,
is there a possibility to project indicators in the future beyond the lastbar on chart without using positive or negative displace ?
I ask this because I'm trying to create a cyclical indicator which projects in the future an hypotetical trend of the market, but I can't plot it beyond the last bar even if its creation doesn't depend on any data in the chart (NOT used open, high, low, close, volume ecc...) . It's a sinewave indicator which starts in a given date and time and moves on in the same way in the future respecting the parameters of lenght and slope given in the inputs panel.
Attached there is a snapshot of what I'm trying to create and then what I've seen on the web using Metastock (the same indicator but maybe with a projection beyond lastbar on chart).
Is there the possibility to project this indicator not only to the last bar on chart, but for example to the maxbarsforward ??
Thank
CraZy
if you have the formula... just plot it with plot[-1] and the line will go to the next bar, plot it with plot[-2] and the line will go to the bar after, and so on.
Re: Powerlanguage and projection in the future
When I tried Plotxx[-2] a couple of months ago it barked at me.
Have you actually gotten that to work? If so, I may give that another try.
Is there some setting needed to enable it?
Have you actually gotten that to work? If so, I may give that another try.
Is there some setting needed to enable it?
- CrazyNasdaq
- Posts: 322
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 90 times
Re: Powerlanguage and projection in the future
I tried it but it doesn't work.
Plotx[-2] is a simple front displace of the indicator but it moves forward the starting point of 2 periods or "N" periods.
I was searching a way to plot in the future a line without moving/displacing the starting point.
The starting point must stay anchored but with Plotx[-2] you move forward the entire line and the starting point too.
Plotx[-2] is a simple front displace of the indicator but it moves forward the starting point of 2 periods or "N" periods.
I was searching a way to plot in the future a line without moving/displacing the starting point.
The starting point must stay anchored but with Plotx[-2] you move forward the entire line and the starting point too.
- TJ
- Posts: 7746
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2225 times
Re: Powerlanguage and projection in the future
No, I am not talking about displace.I tried it but it doesn't work.
Plotx[-2] is a simple front displace of the indicator but it moves forward the starting point of 2 periods or "N" periods.
I was searching a way to plot in the future a line without moving/displacing the starting point.
The starting point must stay anchored but with Plotx[-2] you move forward the entire line and the starting point too.
A displaced plot simply shift the plot by [-1].
I am talking about a formula... if you have the formula of your "cyclical indicator", you can modify the indicator to plot into the future bars with [-1]....
Re: Powerlanguage and projection in the future
It turns out this worked for a subset of my indicators but failed for some that used bars at multiple time resolutions.When I tried Plotxx[-2] a couple of months ago it barked at me.
I suspect it is an edge case bug and I will try to submit a simple test case to the PM site.
- TJ
- Posts: 7746
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2225 times
Re: Powerlanguage and projection in the future
you can project as far into the future as there are FREE chart space available.It turns out this worked for a subset of my indicators but failed for some that used bars at multiple time resolutions.When I tried Plotxx[-2] a couple of months ago it barked at me.
I suspect it is an edge case bug and I will try to submit a simple test case to the PM site.
ie. if there are 50 bars of free space to the right of the current bar, you can make plot[-50], but should not make a plot[-51], otherwise an error will show up.
- TJ
- Posts: 7746
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2225 times
Re: Powerlanguage and projection in the future
YW.Bingo. Thanks, TJ. I was fooled because the windows that failed had multiple instruments in them and thought that it was the cause.
Hope you can post some screenshots to to whet our curiosity.
- CrazyNasdaq
- Posts: 322
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 90 times
Re: Powerlanguage and projection in the future
Sorry, but I don't understand where I should put the string "[- N]" in my code.
This is the portion of my indicator that plots a cyclical curve and stop exactly on the last bar, starting from the beginning that I've setted.
"ciclo_f" is a propietary function that calculates the line of the indicator.
If I modify
I get a simple forward displace (not what I'd like to obtain).
If I modify the code with
Multicharts give me back an error study:
"Trying to access at data to future. Bars reference value: -N."
So, Now sorry for my misunderstanding, but I don't know where I could modify the code.
This is the portion of my indicator that plots a cyclical curve and stop exactly on the last bar, starting from the beginning that I've setted.
"ciclo_f" is a propietary function that calculates the line of the indicator.
Code: Select all
ciclo = ciclo_f(Lunghezza, Num.Cicli,StartTime, StartMonth, StartDay, StartYear, Tendenza, Forza);
If Started then begin
Plot1(ciclo, "ciclo");
end else begin
NOplot(ciclo);
end;
Code: Select all
Plot1[-N](ciclo, "Ciclo");
If I modify the code with
Code: Select all
Plot1(ciclo[-N], "Ciclo")
"Trying to access at data to future. Bars reference value: -N."
So, Now sorry for my misunderstanding, but I don't know where I could modify the code.
- Attachments
-
- Ciclo.png
- (41.73 KiB) Downloaded 1900 times
Re: Powerlanguage and projection in the future
You need to put your calculated and your projected value into one array and the forward it as one plot.
I.e. if you want a history of 400 bars and a projection of 100 bars then put it into one array.
I.e. if you want a history of 400 bars and a projection of 100 bars then put it into one array.
Code: Select all
vars: x1(0),x2(0),x3(0);
Array: CycleValue [500] (0);
// Replace Close with your ciclo
// History
for x1= 400 downto 0
begin
CycleValue [x1] = Close [400-x1];
end;
// Projected values
for x2= 401 to 500
begin
CycleValue [x2] = Close [0]+Close [0]*Random(.005);
end;
for x3 = 0 to 500 begin
plot1 [400-x3](CycleValue [x3] ," 1" ) ;
end;