Announcement

Collapse
No announcement yet.

MA line not generated for last bar

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

  • MA line not generated for last bar

    Hi,

    I have a fairly simple EMA study that seems to be producing values correctly for all but the final bar (see attachment).

    Above preMain:
    var PMP = new MAStudy(vPMP_Sample, 0, "HL/2", MAStudy.SIMPLE);

    var FastEMA_of_PMP = new MAStudy(vFastXAP_Sample, 0, PMP, MAStudy.MA, MAStudy.EXPONENTIAL);

    Main:
    var vFastXAP_Current = FastEMA_of_PMP.getValue(MAStudy.MA, 0);

    var vFastXAP_Previous = FastEMA_of_PMP.getValue(MAStudy.MA, vFastXAP_LookBack);

    if (vFastXAP_Current > (vFastXAP_Previous+vRangeDiff)) {
    setBarFgColor(Color.green,0);
    }

    I have tried setComputeOnClose(true) or (false), it makes no difference.

    Can anyone help, please?
    Attached Files

  • #2
    Re: MA line not generated for last bar

    daborn-fox
    Make sure you do not have the global setting "Make all formulas compute on close..." enabled (see in Tools-> EFS-> Settings)
    Alex


    Originally posted by daborn-fox
    Hi,

    I have a fairly simple EMA study that seems to be producing values correctly for all but the final bar (see attachment).

    Above preMain:
    var PMP = new MAStudy(vPMP_Sample, 0, "HL/2", MAStudy.SIMPLE);

    var FastEMA_of_PMP = new MAStudy(vFastXAP_Sample, 0, PMP, MAStudy.MA, MAStudy.EXPONENTIAL);

    Main:
    var vFastXAP_Current = FastEMA_of_PMP.getValue(MAStudy.MA, 0);

    var vFastXAP_Previous = FastEMA_of_PMP.getValue(MAStudy.MA, vFastXAP_LookBack);

    if (vFastXAP_Current > (vFastXAP_Previous+vRangeDiff)) {
    setBarFgColor(Color.green,0);
    }

    I have tried setComputeOnClose(true) or (false), it makes no difference.

    Can anyone help, please?

    Comment


    • #3
      Thank you, I checked and that was not set. I tried setting it, not setting it and both combinations with SetComputeOnClose choices but no combination made a difference.

      I now have Make all formulas compute on close disabled (unchecked) and SetComputeOnClose set to true.

      Comment


      • #4
        daborn-fox
        Also, the setComputeOnClose() function does not use any parameters [see the article in the EFS KnowledgeBase] so even if you have it as setComputeOnClose(false) the charts will still compute on close only. You need to delete or comment out the statement
        Alex

        Comment


        • #5
          Thanks, that's done it. I definately saw an article somewhere with SetComputeOnClose having a parameter but that must have been wrong.

          Many thanks for your help!
          Attached Files

          Comment


          • #6
            daborn-fox
            You are welcome
            Alex


            Originally posted by daborn-fox
            Thanks, that's done it. I definately saw an article somewhere with SetComputeOnClose having a parameter but that must have been wrong.

            Many thanks for your help!

            Comment

            Working...
            X