NexusFi: Find Your Edge


Home Menu

 





How to Build a Custom Scan


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one mbgaskins with 2 posts (1 thanks)
    2. looks_two kcrawford with 1 posts (0 thanks)
    3. looks_3 gfullmer with 1 posts (0 thanks)
    4. looks_4 Cloudy with 1 posts (4 thanks)
    1. trending_up 27,073 views
    2. thumb_up 5 thanks given
    3. group 6 followers
    1. forum 7 posts
    2. attach_file 3 attachments




 
Search this Thread

How to Build a Custom Scan

  #1 (permalink)
mbgaskins
Tulsa, OK
 
Posts: 2 since Nov 2012
Thanks Given: 1
Thanks Received: 1

I have been trying to build a custom scan using PPO & ADX.

I can get a label with the PPO and ADX and color the label based upon the PPO and ADX action but cannot get a scan to work.

I want to scan for stocks that have PPO down from 5 days ago and ADX up from 5 days ago.

Following is the code I have. Can someone suggest how to get this to run as a scan?

Thanks!
Brad

#PPO ADX Label

Input PPOShortEMA = 9;
Input PPOLongEMA = 26;
Input ADXLength = 14;

Def PPO = (MovAvgExponential(Close,PPOShortEMA) - MovAvgExponential(Close,PPOLongEMA))/MovAvgExponential(Close,PPOLongEMA);
Def PreviousPPO = (MovAvgExponential(Close,PPOShortEMA)[5] - MovAvgExponential(Close,PPOLongEMA)[5])/MovAvgExponential(Close,PPOLongEMA)[5];
Def CurrentADX = ADX(ADXLength);
Def PreviousADX = ADX(ADXLength)[5];

addlabel(yes,concat("PPO ", ROUND(PPO*100,2)), if PPO < PreviousPPO then color.RED else if PPO > PreviousPPO then color.green else color.gray);
addlabel(yes,concat("ADX ", ROUND(ADX(ADXLength),2)), if CurrentADX > PreviousADX then color.RED else if CurrentADX < PreviousADX then color.green else color.gray);

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NexusFi Journal Challenge - May 2024
Feedback and Announcements
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 Cloudy 
desert CA
 
Experience: Intermediate
Platform: NT7, various
Broker: various, TDA
Trading: NQ,ES
Posts: 2,124 since Jul 2011
Thanks Given: 2,396
Thanks Received: 1,748

Hi, unless I'm mistaken, TOS Scan->Stock Hacker seems to have only custom study filters in the form of expressions.

So I made one custom filter for PPO down from 5 days ago & ADX up from 5 days ago, and then another one for the reverse conditions.

Then clicking on scan came up with a result list. Which the results can be saved as a watchlist and then seen in "Marketwatch" -> Quotes


Scripts for custom study filters. (reverse "<" and ">" operators for reverse condition custom study filter)
-------------------------------------------

((MovAvgExponential(Close,9) - (MovAvgExponential(Close,26)/MovAvgExponential(Close,26)))
< (MovAvgExponential(Close,9)[5]- (MovAvgExponential(Close,26)[5])/MovAvgExponential(Close,26)[5]))

and

ADX(14) > ADX(14)[5]



script for column headers:
------------------------------------

# PPO down from 5 days ago

Input PPOShortEMA = 9;
Input PPOLongEMA = 26;
Input ADXLength = 14;

Def PPO = (MovAvgExponential(Close,PPOShortEMA) - MovAvgExponential(Close,PPOLongEMA))/MovAvgExponential(Close,PPOLongEMA);
Def PreviousPPO = (MovAvgExponential(Close,PPOShortEMA)[5] - MovAvgExponential(Close,PPOLongEMA)[5])/MovAvgExponential(Close,PPOLongEMA)[5];
Def CurrentADX = ADX(ADXLength);
Def PreviousADX = ADX(ADXLength)[5];

plot result = PPO;
result.assignValueColor(Color.gray);

assignBackgroundColor(if PPO < PreviousPPO then color.RED else if PPO > PreviousPPO then color.green else color.gray);


-------------------------------------

#ADX up from 5 days ago

Input PPOShortEMA = 9;
Input PPOLongEMA = 26;
Input ADXLength = 14;

Def PPO = (MovAvgExponential(Close,PPOShortEMA) - MovAvgExponential(Close,PPOLongEMA))/MovAvgExponential(Close,PPOLongEMA);
Def PreviousPPO = (MovAvgExponential(Close,PPOShortEMA)[5] - MovAvgExponential(Close,PPOLongEMA)[5])/MovAvgExponential(Close,PPOLongEMA)[5];
Def CurrentADX = ADX(ADXLength);
Def PreviousADX = ADX(ADXLength)[5];

plot result = PPO;
result.assignValueColor(Color.gray);

assignBackgroundColor( if CurrentADX > PreviousADX then color.RED else if CurrentADX < PreviousADX then color.green else color.gray);


Attached Thumbnails
Click image for larger version

Name:	ppo_dn5_adx_up5.JPG
Views:	1162
Size:	302.2 KB
ID:	108584   Click image for larger version

Name:	marketwatch.JPG
Views:	746
Size:	263.5 KB
ID:	108587   Click image for larger version

Name:	ppo_up5_adx_dn5.JPG
Views:	726
Size:	261.8 KB
ID:	108588  
Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
mbgaskins
Tulsa, OK
 
Posts: 2 since Nov 2012
Thanks Given: 1
Thanks Received: 1


Thanks. This gives me what I asked for but not what I wanted. Back to the drawing board to refine my parameters.

This will allow me to get the scan I want as soon as I get the parameters correct.

Reply With Quote
  #4 (permalink)
Yakito
Buenos Aires, Argentina
 
Posts: 47 since Jun 2013
Thanks Given: 39
Thanks Received: 4

I am always getting an "RESULT_ERROR Script execution timeout" when I try to scan many of my custom filters.

Some work, but many (like the following) will fail. Do you think its a temporary error by TOS or I am doing something wrong?

 
Code
close("period" = AggregationPeriod.DAY) is greater than DarvasBox()."Upper Band" from 1 bars ago
Any tip will be much appreciated! Thanks

Reply With Quote
  #5 (permalink)
 jnicassio 
Newbury Park , California/United States
 
Experience: Intermediate
Platform: ToS, Tradestation
Trading: Futures
Posts: 4 since Oct 2013
Thanks Given: 5
Thanks Received: 3

Hi,

I was wondering if you were able to come up for a scan or have seen an indicator for the PPO & ADX scan you were working on. Were you looking for candidates for the PPO/ADX "squeeze'? ( I'm not sure what else to call it)
I am working on a couple things for that trade. Let me know you if that is a trade you do. I have seen a good webinar by Wendy Kirkland discussing how she trades that in her portfolio. Thanks!

Josh

Reply With Quote
  #6 (permalink)
Saul
Carteret NJ
 
Posts: 7 since Oct 2014
Thanks Given: 3
Thanks Received: 0

In reference to this post,
does anyone have the think-script to place in TOS to scan for these PPO pinch as a scan setup
or any PPO scan.

Reply With Quote
  #7 (permalink)
 
gfullmer's Avatar
 gfullmer 
Phoenix, AZ
 
Experience: Intermediate
Platform: Nijatrader, TradeStation
Broker: Interactive Brokers
Trading: Stocks, Options
Posts: 11 since Oct 2014
Thanks Given: 15
Thanks Received: 1

I have been working on Kirkland's squeeze in Ninjatrader as a system and not just a scanner. I have tried a number of ways with comparing a bunch of adx(n)s and ppo(n)s and setting a flag for each and when both hit within some spread buying. Sometimes the "squeeze" doesn't come at the same precise time. I have also tried the Ninjatrader Slope function for adx() and ppo() and setting buy signals based on that. It does work, but usually on all squeezes and not just the major ones. I am looking to do a ratio so I can get the really close squeezes. Maybe by normalizing the adx/ppo ratio. Any ideas?

https://gfullmer.atwebpages.com/screen.html

Follow me on Twitter Reply With Quote
  #8 (permalink)
 
kcrawford's Avatar
 kcrawford 
Honolulu, HI/USA
 
Experience: Advanced
Platform: NinjaTrader
Trading: ES
Posts: 20 since Jun 2013
Thanks Given: 11
Thanks Received: 31

- Ken

Reply With Quote




Last Updated on December 22, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts