Automatically Generate Price Levels

ProfessorZoom

New member
Hello! How would I go about automatically generate price levels? For example, I want to add a price level every 10 points. If I put the study on, say AAPL, it will post price levels at 100, 110, 120, 130, 140, etc. How could I go about doing this? I found "fold" but I can't seem to use it for this. Any ideas?
 
Solution
@ProfessorZoom Mobius of the TSL coded this up a while ago. Perhaps you can adjust it to fit your needs. The default color of the lines is black, so you may have to change the colors to see it on a black chart background.
Code:
#07.01.2020 posted in chat
#12:53 Mobius: This is off the wall - especially for me.  But if your trading Futures then you should at least give it a look-see.

# Threes and Eights
# Mobius
# Each future has a rhythm. Yeah, Yeah I know, sounds like hocus-pocus and so it is. But none the less I find it useful to trade these levels in /ES.  I've had a noticeable profit increase. A couple points.  Especially on those mid-level trades where there's no real good pivot to trade to. Every futures contract can be tuned...
@ProfessorZoom A little research on your part would have revealed just how easy your request actually is... In the future, do research in the Thinkscript Learning Center rather than expecting others to simply hand you code... Members are expected to learn, not just expect others to do their coding for them, regardless of how easy the solution might be... You'll probably end up learning more than you expected along the way... 💡

Ruby:
plot p100 = 100;
plot p110 = 110;
plot p120 = 120;
etc...
 

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

A little research on your part would have revealed just how easy your request actually is... In the future, do research in the Thinkscript Learning Center rather than expecting others to simply hand you code... Members are expected to learn, not just expect others to do their coding for them, regardless of how easy the solution might be
Very rude. I did do research, The thinkScript documentation/learning center is always the first place I go. I said I found "fold" but couldn't figure how to to apply it price levels. Also, AAPL was an example. Not every symbol is in the low one hundreds. I want to figure out how to DYNAMICALLY add price levels without typing plot = X for two thousands lines to support high # symbols like /NQ. Obviously if I want to plot 100 and 110 I can just do what you put. I want to add them for a certain amount above and below the current price, dynamically, I don't want to write ten thousand lines of repeated code, like I said in the post title and OP, automatically generate price levels.
 
Last edited:
@ProfessorZoom Mobius of the TSL coded this up a while ago. Perhaps you can adjust it to fit your needs. The default color of the lines is black, so you may have to change the colors to see it on a black chart background.
Code:
#07.01.2020 posted in chat
#12:53 Mobius: This is off the wall - especially for me.  But if your trading Futures then you should at least give it a look-see.

# Threes and Eights
# Mobius
# Each future has a rhythm. Yeah, Yeah I know, sounds like hocus-pocus and so it is. But none the less I find it useful to trade these levels in /ES.  I've had a noticeable profit increase. A couple points.  Especially on those mid-level trades where there's no real good pivot to trade to. Every futures contract can be tuned to what you observe it's levels to be. My "feeling" is that these levels simply have to do with human nature. Ask anyone to pick a number from 1 to 10 and see how many pick 3 or 8.

input coef1 = 3;
input coef2 = 8;

def c = close; 
def nan = double.nan; 
plot coef_1 = (highestAll(if isNaN(c[-1])
                          then Round(c / 10, 0) * 10
                          else nan)) + coef1;
     coef_1.SetDefaultColor(CreateColor(25,25,25));
plot coef_1_up = highestAll(coef_1 + 10);
     coef_1_up.SetDefaultColor(CreateColor(25,25,25));
plot coef_1_up2 = highestAll(coef_1 + 20);
     coef_1_up2.SetDefaultColor(CreateColor(25,25,25));
plot coef_1_dn = highestAll(coef_1 - 10);
     coef_1_dn.SetDefaultColor(CreateColor(25,25,25));
plot coef_1_dn2 = highestAll(coef_1 - 20);
     coef_1_dn2.SetDefaultColor(CreateColor(25,25,25));
plot coef_2 = (HighestAll(if isNaN(c[-1])
                         then Round(c / 10, 0) * 10
                         else nan)) + coef2;
     coef_2.SetDefaultColor(CreateColor(25,25,25));
plot coef_2_up = highestAll(coef_2 + 10);
     coef_2_up.SetDefaultColor(CreateColor(25,25,25));
plot coef_2_up2 = highestAll(coef_2 + 20);
     coef_2_up2.SetDefaultColor(CreateColor(25,25,25));
plot coef_2_dn = highestAll(coef_2 - 10);
     coef_2_dn.SetDefaultColor(CreateColor(25,25,25));
plot coef_2_dn2 = highestAll(coef_2 - 20);
     coef_2_dn2.SetDefaultColor(CreateColor(25,25,25));
# End Code
 
Solution
@ProfessorZoom Mobius of the TSL coded this up a while ago. Perhaps you can adjust it to fit your needs. The default color of the lines is black, so you may have to change the colors to see it on a black chart background.
Thank you. This is exactly what I was trying to achieve. So using HighestAll and then incrementating and decrementing off that. Perfect. Thank you!
 
@ProfessorZoom I wasn't being rude at all, regardless of you feelings on the subject... Perhaps my style isn't up to your liking but I contribute a heck of a lot more here than you do and have a better feel for the pulse of these forums... We've been getting a lot of lazy new members here and although you may not be new, I have no idea how much effort you put in before posting because your post was so brief... Had your request been more specific then my reply would most likely have been more specific as well... We're trying to get members to do research rather than simply asking for instant gratification... No offense intended nor taken...
 
@ProfessorZoom Had you posted your efforts, rather than simply stating you found "fold", then perhaps there would have been more credibility to your initial post... Your post count tells us nothing about your coding experience, which was two posts as of the start of this topic... Granted, you managed to mention "dynamically", but how is one to know whether you understood the concept... As support of that, I don't see where "fold" was part of the solution... Point out what you like but the fact remains that you had to rely on others to do your coding for you... That fact cannot be denied so I stand by my comments... 💡
 
I'm not sure why you're hellbent on not giving code out to people. How do you think people learn? Ever heard of Stack Overflow?

Yes, I've heard of Stack Overflow and was even a member years ago, but I'm not overly fond of the platform...

I've given more than my fair share of code out over the years and even had my own open source CMS project, complete with forums... The point is that we are trying to instill in members that these forums are for learning to code rather than just asking for others to do the work... Whether you fall into that category or not is subjective... Trust me, this ain't my first rodeo... I guess you could say that I'm hellbent on helping folks learn, but perhaps a bit differently than what some might like... I find that when folks get riled up it usually means I've hit close to home as sometimes the truth hurts... But if it motivates them then it was worthwhile in the long run...

And to put another spin on things, I've had code pirated in the past which cost me unknown thousands in income, so if I hand out some "tough love" at times it's for good reason... I think we've even had a few folks snooping around here that have had less than honorable intentions... But that's a story for another day... Trade on...
 
i need help in regards to the code, can someone please help me ...
I want to plot 16 ticks above and below the open of the /ZB starting 8:20 and also plot 16ticks above and below the overnight high and low starting at 1800. i played around with the coefficient but was unable to get it to dynamically set. and yes i checked the learning center, i have no clue to what im doing.
@ProfessorZoom @MerryDay @Pensar @BenTen @rad14733
 
Last edited:

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
417 Online
Create Post

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