some new code via TOS Tscript Lounge
I have not looked hard at it yet, thought I
would grab and store it
=====================================================
#Begin Code
#Manual Entry Price Level Alert System
#7/2/2013
Input FirstAlertLevel = 0.0;
Input SecondAlertLevel =0.0;
Input ToleranceLevel = 1.0;
Input AscendingDistance = 10;
Input AlertType = 1;
Input AlertMessage = "";
input CustomBackgroundColor = yes;
input Color = 6;
#Hint FirstAlertLevel: Manually input a key Price Level of Interest to you.
#Hint SecondAlertLevel: Manually input a key Price Level of Interest to you.
#Hint ToleranceLevel: is how far away from your Price Level would you like to be warned.
#Hint AscendingDistance: Is the amount of bars to calculate for the (isascending) function.
#Hint Alerttype: Choose "1" For Breakout/Breakdown warning or "2" For Buying at Support Selling at Resistance warning.
#Hint AlertMessage: Type in your Own AlertMessage.
#Hint CustomBackgroundColor: if yes then when signal is not in use then background will be one of 6 different Globalcolors. If no then Background will be default for the chart when signal is not in use.
#Hint Color: Choose from 1-6 in order to toggle between Custom Background Colors.
DefineGlobalColor ("Alert Long",Color.dark_Green);
DefineGlobalcolor ("Alert Short",Color.dark_Red);
DefineGlobalColor ("S&R Alert Long",Createcolor(0,51,51));
DefineGlobalcolor ("S&R Alert Short",Createcolor(102,0,102));
Defineglobalcolor ("1",Color.black);
Defineglobalcolor ("2",createcolor(51,51,51));
Defineglobalcolor ("3",createcolor(0,51,102));
Defineglobalcolor ("4",createcolor(204,204,204));
Defineglobalcolor ("5",createcolor(51,51,0));
DefineGlobalColor ("6", CreateColor(32, 47, 59));
Def FirstSupportResistanceZoneHigh = FirstAlertLevel + ToleranceLevel;
Def FirstSupportResistanceZoneLow = FirstAlertLevel - ToleranceLevel;
Def SecondSupportResistanceZoneHigh = SecondAlertLevel + ToleranceLevel;
Def SecondSupportResistanceZoneLow = SecondAlertLevel - ToleranceLevel;
Plot AlertLevelOne = FirstAlertLevel;
AlertLevelOne.Setpaintingstrategy(PaintingStrategy.Dashes);
AlertLevelOne.setdefaultcolor(Color.gray);
AlertLevelOne.Hidebubble();
Plot AlertLevelTwo= FirstAlertLevel;
AlertLevelTwo.Setpaintingstrategy(PaintingStrategy.Dashes);
AlertLevelTwo.setdefaultcolor(Color.gray);
AlertLevelTwo.Hidebubble();
Def IsUP = isascending (Close,AscendingDistance);
Def IsDOWN = !isascending (Close,AscendingDistance);
def BB = if AlertType == 1 then yes else no;
def SR = if AlertType == 2 then yes else no;
Def AlertOne = if BB and IsUP and close >= FirstSupportResistanceZoneLow and Close <= FirstSupportResistanceZoneHigh then 2 else if BB and IsDOWN and Close <= FirstSupportResistanceZoneHigh and Close >= FirstSupportResistanceZoneLow then 4 else if SR and IsDOWN and Close <= FirstSupportResistanceZoneHigh and Close >= FirstSupportResistanceZoneLow then 6 else if SR and IsUP and Close <= FirstSupportResistanceZoneHigh and Close >= FirstSupportResistanceZoneLow then 8 else 0;
#####
Def AlertTwo =if BB and IsUP and close >= SecondSupportResistanceZoneLow and Close <= SecondSupportResistanceZoneHigh then 2 else if BB and IsDOWN and Close <= SecondSupportResistanceZoneHigh and Close >= SecondSupportResistanceZoneLow then 4 else if SR and IsDOWN and Close <= SecondSupportResistanceZoneHigh and Close >= SecondSupportResistanceZoneLow then 6 else if SR and IsUP and Close <= SecondSupportResistanceZoneHigh and Close >= SecondSupportResistanceZoneLow then 8 else 0;
Assignbackgroundcolor (if Alertone ==2 then Globalcolor("Alert Long") else if Alertone ==6 then GlobalColor("S&R Alert Long") else if Alertone ==4 then Globalcolor ("Alert Short") else if Alertone ==8 then Globalcolor("S&R Alert Short") else if AlertTwo ==2 then Globalcolor("Alert Long") else if AlertTwo ==6 then Globalcolor ("S&R Alert Long") else if AlertTwo ==4 then Globalcolor ("Alert Short") else if AlertTwo ==8 then Globalcolor ("S&R Alert Short")
else if Custombackgroundcolor and color == 1 then GlobalColor("1") else if Custombackgroundcolor and color == 2 then GlobalColor("2") else if Custombackgroundcolor and color == 3 then GlobalColor("3") else if Custombackgroundcolor and color == 4 then GlobalColor("4") else if Custombackgroundcolor and color == 5 then GlobalColor ("5") else if Custombackgroundcolor and color == 6 then Globalcolor("6") else Color.CURRENT);
Alert(Alertone > 0,AlertMessage,Alert.Bar,Sound.Ding);
Alert(AlertTwo > 0,AlertMessage,Alert.Bar,Sound.Ding);
addlabel (AlertType ==1 and Alertone or Alerttwo > 0,"Breakout/Breakdown",Color.gray);
addlabel (AlertType ==2 and Alertone or Alerttwo > 0,"Support/Resistance",Color.gray);
### End Code ###
Disaster is Only a Keystroke Away!