Announcement

Collapse
No announcement yet.

Determining direction of MA

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

  • Determining direction of MA

    Hi,

    I'm new to eSignal and .efs so please bear with me if this is a very simple question. I am trying to program (my first) strategy that says only buy when the MA is up and only sell when the MA is down. But ...

    How do I determine the direction of a trend and it's strength?

    Using various examples I have worked out how to plot a MA and I can work out whether it is higher or lower than a price or another MA. However, how do I determine if an MA is heading up or down, and also the stregth of its move, measured either by absolute change or percentage change?

    Any help would be greatly appreciated.

    Thanks

    mmillar

  • #2
    Sounds like you are making good progress!

    You have defined the ma as something like this

    var vEMA10 = new MAStudy(10, 0, "Close", MAStudy.EXPONENTIAL);


    to compare the current ma to the previous ma

    if (
    vEMA10.getValue(MAStudy.MA) < vEMA10.getValue(MAStudy.MA, -1)
    ) onAction1();

    Comment


    • #3
      Brilliant!!

      Thanks very much for the help and for the very quick response.

      I can get on with my programming now.

      cheers

      mmillar

      Comment

      Working...
      X