StockFetcher Forums · Filter Exchange · Scan Basd on the thinkorswim code<< >>Post Follow-up
strategynode
5 posts
msg #121432
Ignore strategynode
modified
9/4/2014 2:04:18 AM

Hi,
I am trying to figure out how to scan based on a study or indicator which thinkorswim has. Its called the TTM_Scalper_alert, the problem is that when I try to look for its source code it says not available not sure why ( I am new to this)

I also found another indicator which seems to give me the same results as the above mentioned study but the code for this one is available:

input signalOffsetFactor = 0.20;
def signalOffset = AvgTrueRange(high, close, low, 9) * signalOffsetFactor;
plot Data = hlc3;
def triggerSell = if(if(close[-1] < high, 1, 0) and (hlc3[-2] < close[-1] or hlc3[-3] < close[-1]), 1, 0);
def triggerBuy = if(if(close[-1] > low, 1, 0) and (hlc3[-2] > close[-1] or hlc3[-3] > close[-1]), 1, 0);
rec buySellSwitch = if(triggerSell, 1, if(triggerBuy, 0, buySellSwitch[1]));
def thirdBarClosed = if(IsNaN(hlc3[-3]), 0, 1);
plot SBS = if(triggerSell and thirdBarClosed and !buySellSwitch[1], high + signaloffset, if(triggerBuy and thirdBarClosed and buySellSwitch[1], low - signaloffset, double.nan));
SBS.SetStyle(curve.FIRM);
SBS.SetPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
SBS.SetLineWeight(2);
# SBS.SetDefaultColor(color.white);

SBS.AssignValueColor(if triggerSell then
if thirdbarclosed then
#UpPos
CreateColor(255, 0, 0) else
#UpNeg
CreateColor(255, 0, 0)
else if Triggerbuy then
#DnPos
CreateColor(0, 255, 0) else
#DnNeg
CreateColor(0, 255, 0));

I want to create two version for this filter 1) short biased and 2) long biased

1) It looks like the relevant code for the short biased (from what I can gather is)

def triggerSell = if(if(close[-1] < high, 1, 0) and (hlc3[-2] < close[-1] or hlc3[-3] < close[-1]), 1, 0);

2) For long Biased

def triggerBuy = if(if(close[-1] > low, 1, 0) and (hlc3[-2] > close[-1] or hlc3[-3] > close[-1]), 1, 0);

Hope I can have somebody help me with this:

Thanks.

PS these are some of the explanations you may need to understand the code

hlc3 = https://tlc.thinkorswim.com/center/charting/thinkscript/reference/Functions/Fundamentals/hlc3.html

StockFetcher Forums · Filter Exchange · Scan Basd on the thinkorswim code<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.