NexusFi: Find Your Edge


Home Menu

 





Python dev trying to get started with thinkscript


Discussion in ThinkOrSwim

Updated
    1. trending_up 5,160 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Python dev trying to get started with thinkscript

  #1 (permalink)
CSharpTrader
Philadelphia, Pa/United States
 
Posts: 3 since Jan 2013
Thanks Given: 1
Thanks Received: 1

Traders, hello...

I have a TOS account, and I thought I'd deviate from my python work, to write some custom scan criteria within the platform. I've hit a bit of a wall; after a day of searching and reading the, uh, 'docs' I'm no closer to a solution. My question is:

In the scanner condition environment (99% of web examples seem to work with strategies), how does one refer to, or loop over (whatever the best way is) past bars?

I'm looking for a 50sma > 200sma over the past 100 days, and no closes below the 200sma over the same lookback. Should be pretty simple. I've tried 'fold' to no avail.. it seems to be a plotting- related function.

Can someone get me started in the right direction? It'd be huge. Thanks!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #2 (permalink)
 growex 
Trubchevsk
 
Experience: Beginner
Platform: tos
Trading: stocks
Posts: 61 since May 2011
Thanks Given: 40
Thanks Received: 79

def avg50 = average(close,50);
def avg200 = average(close,200);
plot x = sum(close< avg200,100)==0 and sum(avg50 > avg200,100)==100;

it will check if close is equal to or greater than avg 200 for 100 days and if avg50 is greater than avg200 for 100 days


Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
CSharpTrader
Philadelphia, Pa/United States
 
Posts: 3 since Jan 2013
Thanks Given: 1
Thanks Received: 1


That is fantastic. Thank you so much...

Reply With Quote
Thanked by:




Last Updated on February 15, 2014


© 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