Hi, I developed an strategy that use audible alerts when current volume bar is greater than previous bar.
Buy1 = close > close[1] and volume > volume[1];
Sell1 = close < close[1] and volume < volume[1];
alert(Buy1, " Buy " + " " + close, Alert.BAR, Sound.Ring);
alert(Sell1, " Sell " + " " + close, Alert.BAR, Sound.Ring);
I need to run a backtest for that, so my question is pretty simple:
How can I get the exact price that the alert triggers in the message?
def buySig = close and Buy1;
def buyPrice = if open[-1] and Buy1 then open[-1] else XXX[-1]; (XXX is where I need the real price that appears in message center)
AddOrder(OrderType.BUY_TO_OPEN, buySig[-1], price = buyPrice, tradeSize = 1, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Buy");
I need the 'message center price' to add into the 'strategy script', cos price triggered when volume > volume[1] is variable.
Buy1 = close > close[1] and volume > volume[1];
Sell1 = close < close[1] and volume < volume[1];
alert(Buy1, " Buy " + " " + close, Alert.BAR, Sound.Ring);
alert(Sell1, " Sell " + " " + close, Alert.BAR, Sound.Ring);
I need to run a backtest for that, so my question is pretty simple:
How can I get the exact price that the alert triggers in the message?
def buySig = close and Buy1;
def buyPrice = if open[-1] and Buy1 then open[-1] else XXX[-1]; (XXX is where I need the real price that appears in message center)
AddOrder(OrderType.BUY_TO_OPEN, buySig[-1], price = buyPrice, tradeSize = 1, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Buy");
I need the 'message center price' to add into the 'strategy script', cos price triggered when volume > volume[1] is variable.
Last edited: