Announcement

Collapse
No announcement yet.

efsExternal plot not updating

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

  • efsExternal plot not updating

    I want to use an efs (myIndicator) as input to another efs (myStrategy). If I try to plot myIndicator from within myStrategy, the plot does not stay current -- it stops plotting after the script is loaded. I created a very simple example:

    PHP Code:
    // myIndicator
    function preMain() {
        
    setPriceStudy(false);
        
    setComputeOnClose();        // tried with and with out this
        
    setDefaultBarFgColor(Color.red0);
    }

    function 
    main() {

        var 
    high();
        var 
    low();
        var 
    h-l;

    return (
    x);

    I'm not clear about efsExternal not compatible with setComputeOnClose(). Does this I mean I can't use that in both the calling script and the called script? or only the calling script. I only need to get the indicator value once per bar (not every tick) so I tried various combinatins of using NEWBAR and/or setComputeOnClose. So the question is how to make the code efficient by calling myIndicator once per bar and still keep the plot current?

    PHP Code:
    // myStrategy
    var xStudy null;
    var 
    bInit false;
        
    }

    function 
    main() {
        if(
    bInit == false){
            
    xStudy efsExternal("myIndicator.efs")
            
    bInit true;
        }

        var 
    nState getBarState();
        if (
    nState == BARSTATE_NEWBAR) {
            var 
    myPlot xStudy.getValue(0);
        }
        
        return (
    myPlot);

Working...
X