Announcement

Collapse
No announcement yet.

LSMA-Loop for eSignal?

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

  • LSMA-Loop for eSignal?

    Hi,

    I saw in a MetaTrader-Forum a Loop for a LSMA and I want to know, how I can create an efs with the "wt"-value?

    Code:
          Draw4HowLong = Bars-Rperiod - 5;                            //Rperiod = 20
          length = Rperiod;                                           //length now = 20
          loopbegin = Draw4HowLong - length - 1; 
          
          for(shift = loopbegin; shift >= 0; shift--)  //  MAIN For Loop
          { 
             sum[1] = 0;                                              
             for(i = length; i >= 1  ; i--)             //LSMA loop
             {
                lengthvar = length + 1;                               //lengthvar = 21  
                lengthvar /= 3;                                       //lengthvar = 7
                tmp = 0;
                tmp = (i - lengthvar)*Close[length-i+shift];         //tmp = 20 - 7 * close[20-i+shift]
                sum[1]+=tmp;
             }
             
             wt[shift] = sum[1]*6/(length*(length+1));
          }

    Perhaps someone has an idea?

    Warm Regards
    Franz
    Franz

  • #2
    Franz
    I believe that is the formula for Rafter's Moving Trend which is just another way of calculating the LSMA.
    Try running a Search for the keyword Rafter and you should find the efs already programmed.
    Alex

    Comment


    • #3
      Thank you Alex!
      Franz

      Comment


      • #4
        Franz
        You are most welcome
        Alex

        Comment

        Working...
        X