Announcement

Collapse
No announcement yet.

Adding moving averages to indicator pane

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding moving averages to indicator pane

    How to add a second moving average to the attached efs file???
    Attached Files

  • #2
    bdeflorio
    The first thing you need to do is to declare a global variable called for example vMAofCCI2 and set that to null (as an example see line 9 of the efs).
    Once you have done that add the following after line 61
    PHP Code:
    if (vMAofCCI2 == nullvMAofCCI2 = new MAStudy(100vCCIMAStudy.MAMAStudy.SIMPLE); 
    Replace 10 with a value of your choice and MAStudy.SIMPLE with MAStudy.EXPONENTIAL (or MAStudy.WEIGHTED, etc) if you want an exponential, weighted, etc average.
    Lastly replace the return statement with the following
    PHP Code:
    return new Array (vCCI.getValue(CCIStudy.CCI), vCCI.getValue(CCIStudy.CCI), 
                      
    vMAofCCI.getValue(MAStudy.MA), vMAofCCI2.getValue(MAStudy.MA)); 
    At this point you will need to add the necessary statements in preMain to set the plot type, color, name of the Cursor Window label, etc. If you then want to make the parameters for the second moving average user definable you will also need to include some FunctionParameters (use the existing ones as an example)
    For information on the preMain statements and on the Function Parameters you may want to review the Tutorials which are available in the EFS KnowledgeBase. Also in the KB and worthwhile reading is the Guide to Developing EFS Indicators.
    If instead you are not interested in learning how to program and just need to have this study written for you then you may want to see the FAQ: How can I get my custom study built?
    Alex

    Comment

    Working...
    X