OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


  Current location        Thread information  
OmniTrader Professional Forum
OmniLanguage Discussion
Indicator bars back
Last Activity 11/19/2018 6:30 PM
4 replies, 869 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
 
back reply
Printer friendly version

^ Top
Joseph Lupo

Veteran
1002525
Posts: 158

Joined: 3/20/2006

User Profile
 
Subject : Indicator bars back
Posted : 6/27/2017 3:22 PM
Post #29595

Does anyone know how to return the value of an indicator but for as many or few bars back as I'd like? Is it possible to only return the value of this indicator below for the previous 50 bars from the current close?


#indicator
Dim x as single
X=c[5]/c
Return x

^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Indicator bars back
Posted : 6/27/2017 3:36 PM
Post #29596 - In reply to #29595

You can only return one value for whatever bar you are on - nor an array.

However the value of a prior bar can be returned, by using Return X[n], where n could be 50 or any other non-negative value that's not greater than the current bar#.



[Edited by Jim Dean on 6/27/2017 3:38 PM]

^ Top
Joseph Lupo

Veteran
1002525
Posts: 158

Joined: 3/20/2006

User Profile
 
Subject : RE: Indicator bars back
Posted : 6/27/2017 3:53 PM
Post #29597 - In reply to #29595

Jim,
I get that x[n] bar back will show me what the vale of x was N bars back ago but I basically want to filter out those values and/or make them zero after so many bars back. So if I want the indicator to return x[0 thru 50] but then want x[51 thru infinity] to return a zero value or not return anything at all. Is that possible?
Thanks
Joe

[Edited by Joseph Lupo on 6/27/2017 3:55 PM]

^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Indicator bars back
Posted : 6/27/2017 3:57 PM
Post #29598 - In reply to #29597

Sorry, no. OLang is deliberately designed to prevent that. It would be using foresight to change the past. You can only assign a value to a variable for a particular bar during that bar.

The SDK allows what you are asking - but that's full VB.net. And, in most cases for indicator or system design, it's "cheating".
^ Top
Joseph Lupo

Veteran
1002525
Posts: 158

Joined: 3/20/2006

User Profile
 
Subject : RE: Indicator bars back
Posted : 7/5/2017 3:22 PM
Post #29619 - In reply to #29595

I am hoping the added information in this post will get me close to a solution.
Like before, I am trying to return the value of an indicator (in this example c[5]/c ) for as many bars back from the current bar as id like, otherwise I want it to return either no value or a zero value. I have an indicator that looks similar but plots based on bars from the start of data instead of bars back from the most current bar.

#Indicator
#Param "periods",500
dim x as single
x=0
if c[periods]>0 then
x= c[5]/c
end if
plot("(x)",(x))
return x

The attached pic should better explain. Each of the 3 indicators is returning c[5]/c but for bars from the start of data (500 bars, 750 bars and 1000 bars), whereas i am looking only return the value of c[5]/c based on bars back from the most recent data.
Thanks if anyone can help with this.
Joe
Attached file : t2.jpg (91KB - 53 downloads)

Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply

Legend    Action      Notification  
Administrator
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.