Intra day price movement

valbona13

New member
Hey folks I am trying to build a scanner which detects if the current mark price is greater than 3% the mark price x minutes ago. Here is what I have so far
Code:
input priceType = PriceType.MARK;
input period = AggregationPeriod.MIN;
def closePeriod = close(period = period, priceType = priceType);
def refPrice = (closePeriod from 2 bars ago) * 1.03;
plot scan = closePeriod > refPrice;

However I get the error "Secondary period not allowed: 1 min." Any suggestions would be appreciated. Also if you think my code would not work the way it is set up currently feel free to chime in with your expertise. It is very much welcomed.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@valbona What timeframe are you attempting to use the scan code on...??? You can set the aggregation in the header of your scan code panel and in the scanner... Therefore you don't need any reference to AggregationPeriod within the scan code itself... That is most likely the source of your error...
 
to echo what rad14733 said, using a 2nd aggregation time, within a scan study, is not allowed.
2nd aggregation is not the second occurance of configuring a time period. it implies setting a different time period than the chart time.
i think you can't set a different time period within a scan study.

yes, remove the aggregation.
remove the code line , period = formula.
remove 'period' from the closeperiod formula.
at the top of the scan code window, select the desired aggregation time.

you seem to be very focused on doing something one way, that you aren't reading and understanding what the message is telling you, ....not allowed.

if an error message mentions something is causing an error, then try changing some of the parameters or disable the relevant code. you could try changing the period from .min to .hour or .day, to see if that changes the outcome. ( i don't think it will work)
then try disabling that bit of code and see if it results in the study working.

https://usethinkscript.com/threads/custom-aggregation-in-scanner.1356/
post #4 TOS does not support custom aggregation for scanners
 
Thanks everyone. We will see tomorrow if anything good comes of it. One brief follow up, I am also having issues getting the scans that are custom to show up on watch lists. Is something special you need to do within the code to allow the results of the scan to be displayed on a watch list
 
Thanks everyone. We will see tomorrow if anything good comes of it. One brief follow up, I am also having issues getting the scans that are custom to show up on watch lists. Is something special you need to do within the code to allow the results of the scan to be displayed on a watch list

You can usually reference the proper plot from your Study as the trigger for your Custom Watchlist Column(s)... This has been covered many many times here in these forums... That means you need to save your Custom Scan logic into a Study so it can be referenced from your Watchlists Custom Quote Formula...
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
412 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top