Saturday, July 21, 2012

thinkscript included: scanning for arrows

people have written me that they are having trouble using my sdi_itsig in a custom scan filter on the thinkdesktop platform. the problem appears to be that sdi_itsig has too many plots. user written studies must have one and only one plot to be eligible for use in a custom scan filter. so rather than rewrite sdi_itsig, i have written a new study that is scanner friendly. i call it sdi_3ga.

3ga is a stripped down version of itsig. it only looks for three green arrows. if you add it to a chart it plots a line that has two values, 0 and 1. while a 0/1 line is not very interesting to look at, sdi_3ga, can be added to a custom scan and that is its entire purpose.

the thinkscript is at the bottom and i assume you know to add a user written study to your platform.

here's how to work with sdi_3ga in the scanner:

click the scan tab, then click stock hacker. you should have a screen like:
click add study filter, then click the pencil icon. you get a pop-up like:
click the editor tab and you get:
in the editor textbox replace the text "ADXcrossover()" with "sdi_3ga()".
you can also select the type, fresh or all.

click ok then ok on the warning pop-up and you are good to scan.


here's the thinkScript:
######################
# sdi_3ga: Three Green Arrow
#hint: Scan friendly study that plots a 1 when investool green arrow signals are present rev: 1.0
http://www.smallDogInvestor.com
# author: allen everhart
# date:19jul2012
# copylefts reserved. This is free software. That means you are free
# to use or modify it for your own usage but not for resale.
# Help me get the word out about my blog by keeping this header
# in place.
input type = { fresh, default all};
def Fulld = StochasticFull("over bought" = 75, "over sold" = 25, "k period" = 14, "d period" = 5)."FullD";
def stochArrow =
  if fulld > 75 then 1
  else if fulld > 25 && fulld[1]<fulld then 1
  else 0;
def greens = if stochArrow && MACDHistogram("fast length" = 8, "slow length" = 17, "average type" = "SMA")>0 && close>SimpleMovingAvg(length = 30) then 1 else 0;
plot sdi_3ga =
  if type==type.fresh && greens==1 && !greens[1] then 1
  else if type==type.all && greens==1 then 1
  else 0;

6 comments:

  1. Thank you for sharing!!

    ReplyDelete
  2. Thanks for the code...I know it was a lot of hard work.

    ReplyDelete
  3. I am lost in the code issue. I know how to add the one u have here but I'm trying to make a code that says if stochfull k is "x" or higher than prior period then signal. And vice versa if it is "x lower than prior day then signal... Know anyone that can help?

    ReplyDelete
  4. I am lost in the code issue. I know how to add the one u have here but I'm trying to make a code that says if stochfull k is "x" or higher than prior period then signal. And vice versa if it is "x lower than prior day then signal... Know anyone that can help?

    ReplyDelete
    Replies
    1. I'm not sure exactly what kind of help you are seeking - someone to custom code the script or just a pointer on thinkScript syntax. If the former, I do freelance custom coding - contact me at support@smallDogInvestor.com. If the latter, my pointer is to look at the 'crosses above' and 'crosses below' syntax in the help references.

      Delete