I tried to make this code but the Arrows are not showing up? Any help?
Code:
#Dual_Aggregate_TMO_Arrows
# Dual-Aggregate TMO ((T)rue (M)omentum (O)scillator)
# Idea by Mobius via OneNote
# Created by KHPro | Modified for dual aggregation
# V09.2025 with arrow signals added by ChatGPT
declare lower;
input length = 14;
input calcLength = 5;
input smoothLength = 3;
input agg2 = AggregationPeriod.FIVE_MIN; # Secondary timeframe
# --- Primary TMO (Current Chart Timeframe) ---
def o1 = open;
def c1 = close;
def data1 = fold i1 = 0 to length
with s1
do s1 + (if c1 > getValue(o1, i1)
then 1
else if c1 < getValue(o1, i1)
then -1
else 0);
def ema1 = ExpAverage(data1, calcLength);
def Main1 = ExpAverage(ema1, smoothLength);
def Signal1 = ExpAverage(Main1, smoothLength);
plot TMO1 = Main1;
plot TMOSignal1 = Signal1;
TMO1.AssignValueColor(if Main1 > Signal1 then Color.GREEN else Color.RED);
TMOSignal1.AssignValueColor(if Main1 > Signal1 then Color.GREEN else Color.RED);
TMO1.SetLineWeight(2);
TMOSignal1.SetLineWeight(1);
TMOSignal1.HideBubble();
TMOSignal1.HideTitle();
AddCloud(Main1, Signal1, Color.GREEN, Color.RED);
# --- Secondary TMO (User-defined Aggregation) ---
def o2 = open(period = agg2);
def c2 = close(period = agg2);
def data2 = fold i2 = 0 to length
with s2
do s2 + (if c2 > getValue(o2, i2)
then 1
else if c2 < getValue(o2, i2)
then -1
else 0);
def ema2 = ExpAverage(data2, calcLength);
def Main2 = ExpAverage(ema2, smoothLength);
def Signal2 = ExpAverage(Main2, smoothLength);
plot TMO2 = Main2;
plot TMOSignal2 = Signal2;
TMO2.AssignValueColor(if Main2 > Signal2 then Color.GREEN else Color.RED);
TMOSignal2.AssignValueColor(if Main2 > Signal2 then Color.GREEN else Color.RED);
TMO2.SetLineWeight(2);
TMOSignal2.SetLineWeight(1);
TMOSignal2.HideBubble();
TMOSignal2.HideTitle();
AddCloud(Main2, Signal2, Color.GREEN, Color.RED);
# --- Reference Lines ---
plot zero = if IsNaN(close) then Double.NaN else 0;
zero.SetDefaultColor(Color.GRAY);
zero.HideBubble();
zero.HideTitle();
plot ob = if IsNaN(close) then Double.NaN else Round(length * 0.7);
plot os = if IsNaN(close) then Double.NaN else -Round(length * 0.7);
ob.SetDefaultColor(Color.GRAY);
os.SetDefaultColor(Color.GRAY);
ob.HideBubble();
ob.HideTitle();
os.HideBubble();
os.HideTitle();
AddCloud(ob, length, Color.LIGHT_RED, Color.LIGHT_RED, no);
AddCloud(-length, os, Color.LIGHT_GREEN, Color.LIGHT_GREEN);
# --- Arrow Signals (both TMOs align) ---
def bullCross1 = Main1 crosses above Signal1;
def bearCross1 = Main1 crosses below Signal1;
def bullCross2 = Main2 crosses above Signal2;
def bearCross2 = Main2 crosses below Signal2;
def bullSignal = bullCross1 and bullCross2;
def bearSignal = bearCross1 and bearCross2;
plot ArrowUp = if bullSignal then -length * 0.6 else Double.NaN;
plot ArrowDown = if bearSignal then length * 0.6 else Double.NaN;
ArrowUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ArrowUp.SetDefaultColor(Color.GREEN);
ArrowUp.SetLineWeight(3);
ArrowDown.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ArrowDown.SetDefaultColor(Color.RED);
ArrowDown.SetLineWeight(3);