@lguides
When creating plots in thinkscript you not only have to define the logic of what you want plotted but you must also state WHERE on the candle or line that you want it plotted. (IE the low, high, open, close, of the candle).
So an example syntax is if mycondition is true then low else double.Nan (print nothing)
Ruby:
input ml = 12;
def Mom = close - close[ml];
plot mm1 = if Mom > 0 then low else double.NaN;
mm1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_up);
mm1.SetDefaultColor(Color.GREEN);
mm1.SetLineWeight(4);
plot mm2 = if Mom < 0 then high else double.NaN;;
mm2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
mm2.SetDefaultColor(Color.RED);
mm2.SetLineWeight(4);
This script is now correct syntax-wise but is probably not what you want.
Just for future reference, it is not unusual for us to fix the 1st mistake we see and call it fixed. Especially if we are not in front of a computer to test. While I can provide guidance on simple fixes, I am not half as smart as @Joshua.
Just for future reference, it is not unusual for us to fix the 1st mistake we see and call it fixed. Especially if we are not in front of a computer to test. While I can provide guidance on simple fixes, I am not half as smart as @Joshua.
I tried something like this but it doesn't works it flatten my candles
Code:
def ml = 12;
plot Mom = close - close[ml];
plot mm1 = if Mom crosses below 0 then close else double.nan;
mm1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
mm1.SetDefaultColor(Color.GREEN);
mm1.SetLineWeight(4);
plot mm2 = if Mom crosses above 0 then close else double.nan;
mm2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
mm2.SetDefaultColor(Color.GREEN);
mm2.SetLineWeight(4);
Not totally Josh I do appreciate it but as I have said above I want this to plot on the upper (chart or candlestick) not on lower because it was obviously possible when declaring it on lower.
@lguides
When creating plots in thinkscript you not only have to define the logic of what you want plotted but you must also state WHERE on the candle or line that you want it plotted. (IE the low, high, open, close, of the candle).
So the syntax is if mycondition is true then low else double.Nan (print nothing)
Ruby:
input ml = 12;
def Mom = close - close[ml];
plot mm1 = if Mom > 0 then low else double.NaN;
mm1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_up);
mm1.SetDefaultColor(Color.GREEN);
mm1.SetLineWeight(4);
plot mm2 = if Mom < 0 then high else double.NaN;;
mm2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
mm2.SetDefaultColor(Color.RED);
mm2.SetLineWeight(4);
This script is now correct syntax-wise but is probably not what you want. View attachment 742
Just for future reference, it is not unusual for us to fix the 1st mistake we see and call it fixed. Especially if we are not in front of a computer to test. While I can provide guidance on simple fixes, I am not half as smart as @Joshua.
Would you mind sharing your code doing that? that was exactly what I want. However, I believe that you used "> 0" instead of "crosses above/below" that's why arrows are placing all around. thanks @MerryDay I appreciate it!
This should be incredibly simple, the reason your candles are being squished in that other example is probably because your plotting "mom" on the upper chart with "fit studies" enabled in options. Change "plot mom" to "def mom" or uncheck that box.
This should be incredibly simple, the reason your candles are being squished in that other example is probably because your plotting "mom" on the upper chart with "fit studies" enabled in options. Change "plot mom" to "def mom" or uncheck that box.
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.
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.