Site icon Thinkorswim Thinkscript Studies

ALMA Strategy

ALMA Strategy gives the buy and sell signal and it worked great, attaching the results for the samebelow

Read more
# ALMA (Arnaud Legoux Moving Average) 
# ALMA is based on a shifted Gaussian distribution  
# Mobius 
# Chat Room Request 
# ALMA color change added by ZupDog 
input offset = 2; #default was 2 
input sigma = .5; 
input length = 8; 
plot alma_ = (fold n = 0 to length 
              with s 
              do s + getValue(Exp(-Power(n - Floor(offset * length), 2)/ 
                             (2 * Power((length + 1) / sigma, 2)))*  
                     getValue(close, n), n, length)) /  
              fold nn = 0 to length  
              with ss  
              do ss + getValue(Exp(-Power(nn - Floor(offset * length), 2)/ 
                              (2 * Power((length + 1) / sigma, 2))), nn); 
alma_.DefineColor("Up", color.LIME); 
alma_.DefineColor("Down", color.PINK); 
alma_.AssignValueColor(if alma_ > alma_[1] then alma_.color("Up") else alma_.color("Down")); 
alma_.setLineWeight(3); 
# End Code ALMA 
def LongEntry = alma_ > alma_[1]; 
def longExit = alma_ < alma_[1]; 
addOrder(OrderType.BUY_TO_OPEN, longEntry, price = OPEN[-1]); 
addOrder(orderType.SELL_TO_CLOSE, longexit, price = OPEN[-1]); 
Exit mobile version