How do I manipulate two or more existing efs formulas. Add one formula to another (or subtract, multiply or divide). Thanks
Announcement
Collapse
No announcement yet.
adding two efs formulas together
Collapse
X
-
I think what you are trying to accomplish is to "combine" two or more EFS studies into a single study that you can manipulate - right?
If they are simple studies, you can simply combine the necessary code into a new "combined efs", then start working with it.
If they are complex efs studies, you might opt to have a professional develop it for you?
I'm trying to help, but there is no other way to combine unique efs studies into one without doing a bit of programming.Brad Matheny
eSignal Solution Provider since 2000
-
This is general help for combining two efs formulas together. It can become more complicated depending on the two (or more) efs files you want to combine. Sometimes certain efs files are designed to operate a certain way - for example, one might use setComputeOnClose() where another runs in RT. This could complicate things in combining them.
So, here goes... The simple instructions.
A. Open the most complex of the two studies and verify the following :
- Is it running in RT or with setComputeOnClose()
- Are there specific functions that are included within the efs that need to be maintained.
B. Open the secong EFS file and complete the following comparisons:
- Check all global variables and preMain() for inputs that may be duplicated in the second EFS. If there are multiple inputs/variables with the same name, then you have to rename the new ones as you combine the two efs files.
- Check the "return" statement in main() to determine what changes/additions are required.
C. I suggest you save the EFS (in A above) to a new EFS (the combined one) with a new name, then move the code from one efs into the new combined file.
-- First, start moving over all of the global variables (everything outside of any function). Make sure you don't have duplicate variables in your combined project.
-- Next, move over all of the inputs (in preMain()) and be sure to give them new names if needed. Also, remember to place these new inputs into the main() parameters.
-- Next, start moving over sections of code into the new combined project. I suggest you do this by selecting complete sections of code - from ...
if (whatever) {
.. .. ..
}
to this final } that completes the segment.
Try to place these code segments in the proper location in your combined efs. Remember, if you don't place them in the proper order/location, your new combined efs may not work properly.
-- Next, copy over any required functions into the new combined efs.
-- Last, address the return statement in main(). You'll need to address this to control what is displayed into the cursor window and on the chart.
Now, try to load it up and see if you get any errors.
Hope this helps?Brad Matheny
eSignal Solution Provider since 2000
Comment
-
Code Error - Help
I am trying to add a simple 40 period momentum to accDist using the following code. There is a code error - but I don't know what it is. Help would be appreciated. Thanks
function preMain() {
setPriceStudy(true);
setStudyTitle("acd+mom");
setCursorLabelName("ACDMOM");
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
var fp1 = new FunctionParameter("Series", FunctionParameter);
fp1.setName("ACDMOM");
}
var myAvg = null;
function main(Series){//add the parameter to the main definition
myAvg = (accDist + mom (40));//replace the value with the parameter variable
return myAvg
}
Comment
-
Re: Code Error - Help
global
The error is in the syntax used for the accDist() function which is incomplete. For the description and syntax of this function see this article in the EFS KnowledgeBase
You may want to save this link to the EFS KnowledgeBase so that you can reference all the EFS functions
Alex
Originally posted by global
I am trying to add a simple 40 period momentum to accDist using the following code. There is a code error - but I don't know what it is. Help would be appreciated. Thanks
function preMain() {
setPriceStudy(true);
setStudyTitle("acd+mom");
setCursorLabelName("ACDMOM");
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
var fp1 = new FunctionParameter("Series", FunctionParameter);
fp1.setName("ACDMOM");
}
var myAvg = null;
function main(Series){//add the parameter to the main definition
myAvg = (accDist + mom (40));//replace the value with the parameter variable
return myAvg
}
Comment
Comment