Login or Sign Up
Logging in...
Remember me
Log in
Forgot password or user name?
or
Sign Up
Log in with
Search in titles only
Search in EFS Studies only
Search
Advanced Search
Forums
Articles
Groups
Member List
Forum
EFS Development
EFS Studies
Announcement
Collapse
No announcement yet.
variable as a series
Collapse
X
Collapse
Posts
Latest Activity
Photos
Search
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
sunman4008
Registered User
Join Date:
Jan 2012
Posts:
117
Share
Tweet
#1
variable as a series
04-13-2020, 10:32 AM
Hello,
How do you make a variable a series so you can access historical values with .getValue?
-Mike
LetUsLearn
Registered User
Join Date:
Dec 2014
Posts:
76
Share
Tweet
#2
04-13-2020, 05:13 PM
Hello Mike,
The following series example code is also included as a notepad attachment:
function preMain(){
setPriceStudy(true);
setStudyTitle("Forum Series Example")
}
var xCloseMinusUBB = null; // Global variable
var xCloseMinusLBB = null; // Global variable
var xHighestClose = null; // Global variable
function main(){
if(getBarState() == BARSTATE_ALLBARS){
var nCalcUBB = null;
var nCalcLBB = null;
var nHighestClose = null;
xCloseMinusUBB = efsInternal("CalcCloseMinusUBB") // No function parameters
xCloseMinusLBB = efsInternal("CalcCloseMinusLBB", close(), lowerBB(20, 2)); // Pass 2 function parameters
xHighestClose = highest(10, close()); // Use eSignal's series objects.
}
nCalcUBB = xCloseMinusUBB.getValue(0);
nCalcLBB = xCloseMinusLBB.getValue(-3);
nHighestClose = xHighestClose.getValue(-5);
if(getBarState() != BARSTATE_CURRENTBAR)
debugPrintln(getCurrentBarIndex() + "\t" + close(0) + "\t" + upperBB(20, 2, 0) + "\t" +
lowerBB(20, 2, 0) + "\t" + nCalcUBB + "\t" + nCalcLBB + "\t" + nHighestClose);
return;
}
function CalcCloseMinusUBB(){
return close(0) - upperBB(20, 2, 0)
}
function CalcCloseMinusLBB(nPrice, nLBB){
return nPrice.getValue(0) - nLBB.getValue(0);
}
LetUsLearn
Attached Files
Forum Series Example.txt
(1.3 KB, 197 views)
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
X
Comment