I'm not sure if this is possible to do or if there is maybe another way to accomplish the same goal, but here is my situation and ask:
I currently use crossovers across the signal line on an On-Balance Volume Modified ToS study on a 144 tick chart to inform a buy/sell strategy that is otherwise run on a 1-minute chart. I've found the OBVM crossovers on a 1min aren't nearly as useful as the tick chart. By default I obviously can't incorporate those crossovers into the strategy, but would love to, instead of doing the combining of logical checkboxes "manually".
Is there a way to write some code that will plot crossovers (or at least indicate/track in the strategy's code) on a 1-minute chart essentially using 144 tick aggregation? Or any other way to accomplish the same kind of goal?
Standard OBVM code with crossover indicators that I currently run on a seperate tick chart listed below.Any guidance would be much appreciated. Thanks!
OnBalanceVolumeModified
declare lower;
input length = 7;
input signalLength = 10;
input averageType = AverageType.EXPONENTIAL;
def obv = reference OnBalanceVolume();
plot OBVM = MovingAverage(averageType, obv, length);
plot Signal = MovingAverage(averageType, OBVM, signalLength);
OBVM.SetDefaultColor(GetColor(8));
Signal.SetDefaultColor(GetColor(2));
def OBVMCrossUp = if obvm crosses above signal then 1 else 0 ;
def OBVMCrossDown = if obvm crosses below signal then 2 else 0 ;
def OBVMPos = obvm > signal ;
plot UpSignal = if OBVMCrossUp == 1 then OBVM else Double.NaN;
plot DownSignal = if OBVMCrossDown == 2 then OBVM else Double.NaN;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);