Page 1 of 1

Qscript for Email Alert for Exhaustion Bars and 59 patterns

Posted: Thu Jan 18, 2024 1:32 am
by kiasucapital
Hi I've searched the library but couldn't find anything. I was just wondering if anybody has a qscript to set up alerts for Exhaustion Bars and 59 patterns? Or could give me a clue on how to program this?

Cheers

Re: Qscript for Email Alert for Exhaustion Bars and 59 patterns

Posted: Thu Jan 18, 2024 1:45 pm
by sbank
Here's some simple code on one of the exhaustion bars types:

Code: Select all

#initialize variables
if (barnum==barsback) { 
   bs = 0;
}

#Exbars 1
exb1=ExBars1(6,30);
if (exb1==1) {
  signal1=1;
}                      
if (exb1==-1) {
  signal1=-1;
}   

# go long   
if ((signal = 1) and (bs <= 0)) {
   buy(1,close,"market","onebar");
   SendEmail("email_address", "email_address", "Message From Wave59", "Just went long on CL");
   bs = 1;
}   
Alternatively, if you do not want an e-mail, you can replace that line with something like:

Code: Select all

alert("Just went long CL","");
I use "bs" (buy/sell) as a simple variable to track if we are in an order or not. This is a convention that I picked up from Earik. You can also use the builtin variable marketposition.
  • The first chunk of code initialized bs to zero.
  • The second chunk of code just gets the values from the exhaustion bar function. (You can replace this with the other exhaustion bar function, or 95count, etc.)
  • The third chunk of code says "if we are long, and we are not in a position (bs==0) or we are not short (bs<0), then buy 1 contract, send some mail (or alert), and set bs to 1 so on the next bar it does not trigger again.)
-Steven

Re: Qscript for Email Alert for Exhaustion Bars and 59 patterns

Posted: Fri Jan 19, 2024 3:26 am
by kiasucapital
Awesome Steve! Thanks so much you have been incredibly helpful.

Re: Qscript for Email Alert for Exhaustion Bars and 59 patterns

Posted: Fri Jan 19, 2024 1:37 pm
by sbank
Glad this was of use!

If you really want to get into QScript writing, there is the help file (which is very useful), but more importantly, just look at the indicators and functions that release with Wave59. Some of the stuff can get quite advanced, but I have learned a lot by perusing what Earik and others have done.

(Don't forget about the QScript library at: http://www.wave59.com/library/default.asp
Lots of neat stuff in there. :D