Midway Scalping Strategy
This strategy gets the high and low for the past 30 periods and computes the midway buy zone. If prices closes within the buyzone, it will trigger a buy signal. However, it will only do so if the ALMA is downward sloping, meaning prices (should be) are pulling back from a previous rally.
A sell signal is triggered if prices hits the 30 period high or low. While the backtest looks good, the user can adjust and optimize this strategy more. My suggestion is to make the selling a bit more sensitive, add risk management and/or make the lookback period longer/shorter based on your preference. You can also use the slope function if you want the filter to be less sensitive.
// Midway Scalps
Set ALMA = alma(close,9,.85,6)
Set Topping = max(high,30)
Set Bottom = Min(low,30)
Set 50level = (topping+bottom)/2
Set top = 50level*1.005
Set bot = 50level*.995
//Set Filter = slope(alma,2) < 0
Set Filter = alma < ref(alma,1)
Set Buy = close <top and close>bot and filter
Set sell = close >= topping or close <=bottom