Hypoluxa
Well-known member
How delayed are the arrows going to be or will they populate the same time as the MACDBB dot crosses? Also, since the arrow populates at the crossing, what's the real benefit of the arrow? Is it to alert a signal in case you aren't looking at SPX at the time?@Hypoluxa I took a shot at putting your strategy into a study. All parameters are customizable. It will plot buy and sell signals and alert when signals show up. I was thinking that the BB dots being above and below the zero line can be turned into a percent up or down. Let me know if you can think of any enhancements.
Python:# SPX Strategy # Strategy designed by Hypoluxa # barbaros - 2021/02/25 declare upper; input price = close; input SMAFastLength = 3; input SMASlowLength = 9; input BBlength = 30; input BBNum_Dev = 0.8; input BBCrossInBars = 3; input BBCrossDistance = 1; input MACDfastLength = 8; input MACDslowLength = 16; input MACDLength = 36; input ERGODICLongLength = 2; input ERGODICShortLength = 10; input ERGODICSignalLength = 36; input ERGODICAverageType = {"SIMPLE", default "EXPONENTIAL", "WEIGHTED", "WILDERS", "HULL"}; # Check for 10min chart Assert(GetAggregationPeriod() == AggregationPeriod.TEN_MIN, "Incorrect Chart Time, use 10m"); # MACD def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength); def MACD_Direction = if MACD_Data > MACD_Data[1] then 1 else -1; # Ergodic def Ergodic_Data = ErgodicOsc("long length" = ERGODICLongLength, "short length" = ERGODICShortLength, "signal length" = ERGODICSignalLength, "average type" = ERGODICAverageType).ErgodicOsc; # SMAs def SMA_Fast = SimpleMovingAvg(price, SMAFastLength); def SMA_Slow = SimpleMovingAvg(price, SMASlowLength); # Signals def buySignal = SMA_Fast > SMA_Slow and Ergodic_Data > 0 and MACD_Direction == 1 and MACD_Data >= BBCrossDistance and MACD_Data crosses above 0 within BBCrossInBars bars; def sellSignal = SMA_Fast < SMA_Slow and Ergodic_Data < 0 and MACD_Direction == -1 and MACD_Data <= -BBCrossDistance and MACD_Data crosses below 0 within BBCrossInBars bars; # Plots plot buy = buySignal and !buySignal[1]; buy.setPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy.setDefaultColor(Color.GREEN); buy.setLineWeight(3); plot sell = sellSignal and !sellSignal[1]; sell.setPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell.setDefaultColor(Color.RED); sell.setLineWeight(3); # Alerts Alert(buy, "Buy", Alert.BAR, Sound.Ring); Alert(sell, "Sell", Alert.BAR, Sound.Ring);
I've never used alerts, so that's why I'm asking that one.