Announcement

Collapse
No announcement yet.

Non Standart Formulas ???

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

  • Non Standart Formulas ???

    I got a big problem coding in the efs editor because i cant write the code so well yet... so i use the formula wizzard but there i have the problem that i cant use non standart formulas ... so here is my question :

    Is there a way to make non standart formulas ready for the formula wizzard ... ?
    when not can anybody code me a snippet that colors the background green and red when the 2 lines are crossing ???

    here is the code for the formula i mean

    /************************************************** **************************************************
    Copyright © eSignal, a division of Interactive Data Corporation. 2003. All rights reserved.
    This sample eSignal Formula Script (EFS) may be modified and saved under a new
    filename; however, eSignal is no longer responsible for the functionality once modified.
    eSignal reserves the right to modify and overwrite this EFS file with each new release.
    ************************************************** ************************************************** */
    /*** 5/9/03 Corrected Version
    * Fixed flat-line bug for infrequently traded securities
    ***/

    addBand(80, PS_SOLID, 1, Color.grey, "Upper");
    addBand(20, PS_SOLID, 1, Color.black, "Lower");

    function preMain()
    {
    setStudyTitle("Preferred Stochastic");
    setCursorLabelName("percentK", 0);
    setCursorLabelName("percentD", 1);
    setDefaultBarFgColor(Color.lime, 0);
    setDefaultBarFgColor(Color.red, 1);

    }

    var MAVt = null;
    var MAVt1 = null;
    var MAVt_1 = 0;
    var MAVt1_1 = 0;

    function main(nLength, nSmoothing, nSmoothings) {
    if(nLength == null)
    nLength = 8;
    if(nSmoothing == null)
    nSmoothing = 3;
    if(nSmoothings == null)
    nSmoothings = 3;

    var percentK;
    var ll = 0, hh = 0;
    var sum = 0;
    var vHigh = getValue("High", 0, -nLength);
    var vLow = getValue("Low", 0, -nLength);
    var temp = 0;

    if(vHigh == null || vLow == null)
    return;


    for(j = 0; j < nLength; j++) {
    if(j == 0) {
    ll = vLow[j];
    hh = vHigh[j];
    } else {
    hh = Math.max(hh, vHigh[j]);
    ll = Math.min(ll, vLow[j]);
    }
    }
    percentK = ((close() - ll) / (hh - ll)) * 100;
    if (isNaN(percentK) == false) MAVt = MAVt_1 + (percentK - MAVt_1) / nSmoothing;
    if (getBarState() == BARSTATE_NEWBAR) MAVt_1 = MAVt;
    if (isNaN(percentK) == false) MAVt1 = MAVt1_1 + (MAVt - MAVt1_1) / nSmoothings;
    if (getBarState() == BARSTATE_NEWBAR) MAVt1_1 = MAVt1;

    return new Array(MAVt,MAVt1);
    }
    thank you and regards .... eric

  • #2
    Eric
    The formula you posted is the DiNapoli Prferred Stochastic. Do a Search on the Bulletin Board using those words as keywords as there have been many variations of that formula posted recently.
    Alex

    Comment


    • #3
      no i dont want to search this formula ... i have got it i want to "import" it in the formula wizzard ... because there i cant find it anywhere ...
      regards eric

      Comment


      • #4
        Eric
        You cannot do that. The Formula Wizard can only use the built-ins, so you would need to modify the script using the Editor.
        Again there are various versions available that already do what you are trying to achieve (or something very similar)
        Alex

        Comment

        Working...
        X