Ok here we go with new one for me. I am running out of real estate on my screen so I put MACD and ON Balance Vol in single cell and works great until I have to draw on it... Once you combine 2 indicators TOS shuts downt he drawing tooks for that cell. So i cant draw my divergences etc on it...
So when I combined both in single script they not working... lol
I figure it has something to do with letting it know I want MACD (VALUE and AVG) and ON BAL (OBVM and Signal) to arrow signal as I select on menu.
Any help be great!
Otherwise I keep squished on the monitor as 2 separate indicators. Thank you!!!
#ON Balance and MACD CROSS Dio
#MACD PART TOS Default
#want to use as single indicator so I can use drawing tools on it.
declare lower;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;
plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.Color("Positive and Up") else Diff.Color("Positive and Down") else if Diff < Diff[1] then Diff.Color("Negative and Down") else Diff.Color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#
# this is ON BALANCE modded already
#try to figure out how to to cross both and select which lines to display between both maybe?
def OBVM1 = MovingAverage(averageType, obv, length);
def Signal1 = MovingAverage(averageType, OBVM, signalLength);
def UpSignal1 = OBVM crosses above Signal;
def DwnSignal = OBVM crosses below Signal;
# Arrows
plot bullish1 = if UpSignal then OBVM else Double.NaN ;
plot bearis1 = if DwnSignal then OBVM else Double.NaN ;
##### End Code #####
So when I combined both in single script they not working... lol
I figure it has something to do with letting it know I want MACD (VALUE and AVG) and ON BAL (OBVM and Signal) to arrow signal as I select on menu.
Any help be great!
Otherwise I keep squished on the monitor as 2 separate indicators. Thank you!!!
#ON Balance and MACD CROSS Dio
#MACD PART TOS Default
#want to use as single indicator so I can use drawing tools on it.
declare lower;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;
plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.Color("Positive and Up") else Diff.Color("Positive and Down") else if Diff < Diff[1] then Diff.Color("Negative and Down") else Diff.Color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#
# this is ON BALANCE modded already
#try to figure out how to to cross both and select which lines to display between both maybe?
def OBVM1 = MovingAverage(averageType, obv, length);
def Signal1 = MovingAverage(averageType, OBVM, signalLength);
def UpSignal1 = OBVM crosses above Signal;
def DwnSignal = OBVM crosses below Signal;
# Arrows
plot bullish1 = if UpSignal then OBVM else Double.NaN ;
plot bearis1 = if DwnSignal then OBVM else Double.NaN ;
##### End Code #####
Last edited by a moderator: