Possible to add alerts?

I

ikpllc

New member
Is it possible to add an alert to this buy/sell indicator? Can't figure this out for the life of me...

Code:
def triggerSell = if(if(close[-1] < close,1,0) and (close[-2] < close[-1] or close[-3] <close[-1]),1,0);
def triggerBuy = if(if(close[-1] > close,1,0) and (close[-2] > close[-1] or close[-3] > close[-1]),1,0);
rec buySellSwitch = if(triggerSell, 1, if(triggerBuy, 0, buySellSwitch[1]));
def thirdBarClosed = if(isNan(close[-3]),0,1);
plot SBS = if(triggerSell and thirdBarClosed and !buySellSwitch[1], high,
if(triggerBuy and thirdBarClosed and buySellSwitch[1], low, double.nan));
SBS.setStyle(curve.POINTS);
SBS.setPaintingStrategy(paintingStrategy.LINE_VS_SQUARES);
SBS.setLineWeight(2);
SBS.setDefaultColor(color.white);
 
rad14733

rad14733

Well-known member
VIP
Did you check HERE in the TOS Learning Center...??? You can add Alerts to most scripts based on trigger criteria... In your script, triggerBuy and triggerSell would be your trigger criteria the same as you are using for your plot...
 

Similar threads

Top