SPY trade ideas
SPY July 8th 2025SPY July 8th 2025
Day 2 of journaling my trades. Ended Monday green but not without mistakes. I am heading into Tuesday with more of a neutral outlook. Previous resistance will be tested as support and could find buyers or fail to do so. As I did yesterday, I will give a breakdown of what I’m seeing on all of my charts for both strategies.
+++++++++++++++++++++++++++
Bullish Analysis
Renko: The price pulled back on Monday, as expected, and may continue lower to retest the top of the channel (around $615). Fisher Transform is still in positive territory and strong support at that level could lead to the price reaching higher highs.
500R ($5) chart: Similar structure to the Renko chart. I’m using a higher range here to compensate for volatility. Just like with the Renko chart, a bounce on the top of the channel would be a healthy pullback before higher highs. There is a high volume node on the volume profile, so interest from buyers here could be strong enough to prevent the price from falling back into the channel.
4h chart: The last three candles have the appearance of a healthy pullback. There was declining volume and
the most recent candle is somewhat of a bullish hammer. I also have an anchored VWAP going back to June 30 that the price seems to be respecting. The price bounced off of it in the first 4h candle on Monday and managed to close above it after a dip during the formation of the second candle.
+++++++++++++++++++++++++++
Bearish Analysis
Renko: Same chart with a lower box size ($1 instead of $2). As you can see, there is bearish divergence on Fisher Transform. The price also found likely temporary support before reaching the top of the channel, suggesting that it could make at least one more wave down if a larger corrective trend unfolds. The 1.382 ($614) and 1.618 ($612) Fibonacci extensions will be important reference points to watch. I would feel less confident about the strength of the bullish trend if the price goes beyond the 1.618 extension.
200R ($2) Range: The Range chart in this layout is the only one that I am including extended hours data on, so the channels have slightly different levels. On this chart I am using two trend lines on the upper level to illustrate the possible areas of support/previous resistance. If the price breaks back into the channel and below the 34VWMA, it could signal a trend failure and the price could return to $600 or lower. Volume bars on range charts also offer a different perspective than on time-based candlesticks. Here, since each bar represents a $2 move up or down, the volume inside of each bar can show the level of effort it took to move the price either direction, whereas the time-based charts are simply showing the level of interest during a particular time period. For this reason, consistently high volume during this last move up could be a sign that there is a larger presence of sellers. Lastly, there is Fisher Transform divergence here as well.
1h chart: CME_MINI:ES1! is green overnight, signaling continuation of the bounce we saw at the end of the day on Monday. With a tighter channel, the top was rejected in a classic bearish reversal candle pattern above the channel and made a clean break down below the channel. The price found support just above the anchored VWAP from the start of the channel, so there could still be institutional interest around $617 and below. If this correction were to unfold into three distinct waves, a 0.618 pullback (to the 0.382 level of the fib extension; $623) would retest the previous demand of the channel. A rejection here could have the price looking for support in a lower volume zone. A (c) wave could take the price down to $615-$611.
+++++++++++++++++++++++++++
Options Analysis
As I have explained, I think it is possible that we will see the price hit $623 during the Tuesday session, so it could be an important level for ATM options. TVC:VIX held its level on Monday after the gap up but failed to make progress - finding resistance at the 200MA on the 1h chart. The rounding bottom and bullish candles on the 30m AMEX:SPY chart looks better than other timeframes. From a Wyckoff Method perspective, however, it looks like puts are in a distribution pattern and calls are in accumulation. Volume is low for both of these contracts, but especially lower on the Put option, indicating lack of interest.
If the put contract makes a lower low on Tuesday (below $3.55 or above $620.75 for SPY), this particular contract could break into a downtrend. Calls seem to be the safer bet since the price has already made a higher high and has wider support. An ideal entry would be a false breakout at $0.95 ($621.00 for SPY) or a retest of the top of the channel after a true upside breakout at $1.50 ($622.50 for SPY) The upside breakout possibility would have stronger confirmation, so it would be worth the higher premium price. This movement would need to be accompanied by high volume, of course.
For puts, I would like to see higher volume at the bottom of the range, since it seems like the underlying price will open higher. I would probably switch to a contract with a lower strike since $623 would be ITM but for the sake of this idea, I would target entry of $623p around $3.65 ($620.75 for SPY).
+++++++++++++++++++++++++++
Targets
Calls: Enter $622.50, Target $628-$630, Stop Loss $621
Puts: Enter: $620.75, Target $615, Stop Loss $621.50
To summarize, I like the risk/reward and volume better for calls, and it fits my original thesis, however if volume increases on puts at these elevated levels, it will be important to get in at a price that minimizes risk exposure to take advantage of a deeper correction.
SPY July 7th 2025SPY July 7th 2025
Day 1 of journaling my day trades on SPY. I am going to start journaling my ideas every night if possible in order to fine tune my setup and to analyze my wins and losses. I will be using Renko (Traditional, 2 box size, 1m) as my main chart, Range Bars (50R, 100R, 200R, or 500R), and candle sticks (various timeframes) to identify supply/demand, price ranges, and trends - placing a high emphasis on volume as it applies to the Wyckoff Method. I will also occasionally refer to real time options charts and VIX, however I will primarily use those for my entries during the day.
Each day I will provide setups for a bullish and bearish bias, which should help minimize instances where the price moves against me - with slow reactions leading to holding losing trades and hesitating to enter a trade on the side of the new trend. I’ll try to come up with a consistent format as time goes on. For today, I will go down the list of my indicators and provide notes that fit the bias of each trading strategy.
+++++++++++++++++++++++++++
Bullish Analysis
Renko: Strong breakout from ascending channel on June 30. Fisher Transform is signaling continuation. A retest of the top of the channel would take the price back to ~$618.
100R ($1) Chart: Price is in an uptrend being supported by high volume. 34VWMA (purple) is above 200MA (green). The bounce on July 2nd (around $616) was supported by a high volume node, indicating genuine interest pushing the price higher.
30m Chart: Price closed on July 3rd at the top of an ascending channel inside of a larger ascending channel. Since the larger ascending channel is one of strength, it can be assumed that the smaller one is a sign of strength as well. A break too far below the lower end of this smaller channel would be a sign of weakness, which does not seem to fit the current market structure after last week’s breakouts, but it is still possible that the trend fails. Fisher transform is forming a “hook” pattern that can signal continuation.
+++++++++++++++++++++++++++
Bearish Analysis
On a smaller scale, the price appears due for a pullback, which can fit both the bullish and bearish trading ideas depending on where the market opens.
Renko: The price closed at the top of an ascending channel on July 2nd and will find more buyers upon a test of the lower band and the anchored VWAP.
50R (50¢) Chart: If the price pulls back to the bottom of the channel (around $620) this would coincide with a retracement of 0.618 - which is a key fib level. A break below the 1.00 extension ($616) could signal a break of the uptrend - a $9+ drop if an entry can be found near the top of the channel, not too bad.
5m Chart: The price left a gap down to $620 on July 3rd. Filling this gap could provide important liquidity to propel the price higher. Additionally, The high volume at the start and end of Thursday’s flat trading day (with low volume in between) could be a sign of accumulation or lack of sellers.
1DTE ATM Put, 2m: If a more prolonged (and profitable) downward move is expected from smart money, we should see volume increase for ATM puts during the session. Depending on where things open, we could see a potential spring/false bearish breakout (below $2.20), or a true bullish breakout (above $2.80). Using an options calculator, $623.75 on AMEX:SPY would set up the Spring and a drop below $622.50 could confirm the put breakout.
+++++++++++++++++++++++++++
Targets
Calls: Enter $618-$620, Target $625-$628, Stop Loss $617.75
Puts: Enter $623-$625, Target $620, Stop Loss $626.25
To conclude, overnight action on CME_MINI:ES1! and the gap up on TVC:VIX shows that the price is already retracing. The top of the wedge for VIX would be just above $20 - a key level to watch for a reversal. Unless the upper part of the channel on SPY is tested and rejected again after the open, I will sit out and wait to hit the bullish targets. We are still in a strong uptrend after last week’s breakouts, so going short is the riskier bet anyway, as buyers could step in at any time.
Looking at ATM calls and puts side by side (bottom two charts), it is clear that calls were not heading into today with a good setup. It would be worth taking a chance on puts if a Spring forms (below $2.20), which, again, would correlate with AMEX:SPY hitting $623.75 during the session - and not much higher.
My main idea for the start of this week is to look for a good pullback for calls, so I will be patient and will try not to force anything. If smart money has a bullish sentiment, there will still need to be a short accumulation phase for calls so I will watch to see what the chart is doing for ATM calls around $620.
SPY: How are ya?Long time no talk.
Just an update to appease some people requesting updates haha.
Mostly going over the larger term outlook for SPY, the quarterly and some discussions on the weekly.
As always, not advice and remember to follow your strategies and risk management approaches!
Safe trades everyone!
SPY Breakout Setup – Bullish Pattern Watch! 📈 🟢
SPY has formed a clear ascending triangle with strong support at $616. After a pullback, it’s now breaking out above $620.78 with a bounce from trendline support and rejection of lower prices.
📌 Trade Details:
🔹 Entry: $620.78
🔹 Stop Loss: $616.00
🔹 Target: $624.56
🔹 Pattern: Ascending Triangle Breakout
This setup aligns with market momentum and breakout structure. Great risk-reward for bulls watching major index movement.
—
📊 Posted by: ProfittoPath
#SPY #SP500 #ETFTrading #BreakoutSetup #MarketUpdate #ProfittoPath #TechnicalAnalysis #StockTrader #ChartAnalysis
Nightly $SPY / $SPX Scenarios for July 8, 2025🔮 Nightly AMEX:SPY / SP:SPX Scenarios for July 8, 2025 🔮
🌍 Market-Moving News 🌍
📉 U.S. Stocks Slip on New Tariff Threats
President Trump announced plans to impose 25% tariffs on imports from Japan, South Korea, Malaysia, Kazakhstan, South Africa, Laos, and Myanmar starting August 1, reigniting trade jitters. The Dow fell ~0.9%, the S&P 500 dropped ~0.8%, and the Nasdaq slid ~0.9% on the news, while bond futures rallied and the dollar strengthened
⚖️ Tariff Pause Deadline Looms
Markets are focused on the July 9 deadline for the current tariff pause, which now hinges on imminent trade negotiations. Investors are balancing the risk of reimposition against progress with agreements involving the U.K., Vietnam, and Canada
💵 Consumer Credit Moderates
June’s consumer credit increase slowed to $10.60 billion vs. April’s $17.87 billion—still strong, but a cooling sign in household borrowing patterns. This tempered the dollar’s rise amid mixed signals on consumer resilience.
🛢️ Oil Drops on Rising OPEC+ Supply
Oil prices fell, with Brent dipping to ~$68.00/barrel and WTI to ~$65.30, after confirmation of OPEC+’s August supply hike—adding to bearish cues for energy stocks .
📊 Key Data Releases & Events 📊
📅 Tuesday, July 8:
3:00 PM ET – Consumer Credit (June)
Moderation in borrowing signals possible easing in consumer-driven growth.
4:30 PM ET – API Weekly Crude Inventories
A key indicator for energy markets; lower inventories lift oil prices, while builds push them down.
Throughout the Day – Tariff Pause Deadline
Market stability hinges on whether trade agreements materialize before the break expires.
⚠️ Disclaimer:
This information is for educational and informational purposes only and should not be construed as financial advice. Always consult a licensed financial advisor before making investment decisions.
📌 #trading #stockmarket #economy #tariffs #consumercredit #oil #technicalanalysis
Weekly $SPY / $SPX Scenarios for July 7–11, 2025🔮 Weekly AMEX:SPY / SP:SPX Scenarios for July 7–11, 2025 🔮
🌍 Market‑Moving News 🌍
📈 From Panic to "Goldilocks" Rally
The S&P 500 and Nasdaq hit fresh record highs, surging ~20% from April lows. Markets rallied on a combination of easing Middle East tensions, the 90‑day tariff pause, a new fiscal bill in Washington, and strong June jobs data. Still, strategists caution that optimism may be ahead of fundamentals, especially if trade volatility returns
💱 Dollar Weakness & Bond Market Watch
The U.S. dollar remains near 3.5‑year lows amid rate‑cut speculation and trade progress. Treasury yields are volatile this week, impacted by concerns over escalating debt issuance, upcoming tariff deadlines (July 9), and the Federal Reserve’s stance .
🏢 Tech Leadership Shifts
With the “Magnificent Seven” tech stocks near heights, growth is spreading: cyclical sectors, small‑caps, and industrials are gaining momentum. AI remains the primary engine, but resilience across a broader stock base is signaling a potentially sustainable rally
⚠️ Tariff Truce Deadline Looms (July 9)
The April tariff pause expires mid‑week. U.S. plans to extend exemptions via trade talks with partners like UK, Vietnam, and Canada—yet any delay or failure may shock markets. Watch for headlines that may trigger spillover effects .
📊 Key Data Releases & Events 📊
📅 Monday, July 7:
Independence Day markets resume. Light trading expected ahead of data and tariff deadline.
📅 Tuesday, July 8:
10:00 AM ET – Consumer Credit (June)
Gauges borrowing trends—an indicator of household health in a low‑rate environment.
📅 Wednesday, July 9:
EIA Crude Oil Inventories & MBA Mortgage Apps & Wholesale Inventories
Key mid‑week data points; oil builds may pressure energy stocks.
Tariff Pause Deadline – Expect market volatility on news of extension or reimposition.
📅 Thursday, July 10:
8:30 AM ET – Initial & Continuing Jobless Claims
10:00 AM ET – Natural Gas Inventories
Markets focus on labor health and energy trends.
📅 Friday, July 11:
10:00 AM ET – Treasury Budget Statement
Details on government borrowing and fiscal outlook—markets sensitive to deficit risks.
⚠️ Disclaimer:
These insights are for educational purposes only—not financial advice. Consult a licensed advisor before making investing decisions.
📌 #trading #stockmarket #economy #news #tariffs #Fed #AI #technicalanalysis
SPY (S&P500 ETF) - Daily Golden Cross and All-Time-High PriceSPY (S&P500 ETF) price has reached all-time-highs in July 2025, after a SMA Golden Cross printed on the daily chart.
SPY is still in a price uptrend since May 2025, however a higher-low pullback has not occurred for the past two weeks.
Resistance levels: $625, $630, $635, $640.
Support levels: $622, $617, $614, $611.
A significant reversal or bearish candle pattern has not occurred yet on either the daily or weekly charts.
The Stochastic RSI indicator has reached overbought levels, both on the Daily chart and Weekly chart.
Stock market earnings season begins in July 2025, trade deal negotiations and new tariffs are in progress this week. Volatility could increase this month due to these news catalysts.
Opportunity Beneath the Fear: SPY's Reversal SetupIn the Shadow of Headlines: SPY’s Drop Could Be 2025’s Big Opportunity
As markets react sharply to renewed tariff fears and Trump-related headlines, SPY continues its descent. Panic is setting in—but behind the noise, a strategic opportunity may be quietly forming.
While many rush to exit, others are beginning to position for the bounce. A well-structured entry strategy could be key to turning uncertainty into gains.
Entry Zone (Staggered):
🔹 543: First watch level—look for signs of slowing momentum.
🔹 515: Deeper entry point as the selloff extends.
🔹 <500 (TBD): Stay flexible—if panic accelerates, this could mark a generational setup.
Profit Targets:
✅ 570: Initial rebound target.
✅ 590: Mid-range level if recovery builds.
✅ 610+: Full recovery potential—rewarding those with patience and vision.
Remember: Headlines fade, but price action and preparation stay. This selloff may continue—but it might also be laying the foundation for 2025’s most powerful move. The key? Enter with discipline, protect your capital, and let the market come to you.
⚠️ Disclaimer: This content is for educational purposes only and does not constitute financial advice. Trading carries significant risk. Always conduct your own research and use proper risk management.
SpySooooo.. the technicals are flashing red.
No earnings
No fed Speak
No economic data
We'll need a catalyst to get the reset going.
There are 2 catalyst
1. Tariffs
2. 30yr bond auction Thursday
I actually think between July 7th- 17th
We will retest the previous high between 610-611. Depending on how long this takes the 20sma should gravitate toward 610 by the End of this week.
The last two major Pullbacks actually took 2weeks and the price action was terrible. I circled it to illustrate
And this is why I said this pullback could take up to July 17th to complete.
July 18th is the kick off of big bank earnings and let me tell you from experience, you don't want to be going into earning season short especially if seasonality is against you.
Banking sector
AMEX:XLF
I think price pulls back with the rest of the marker but pushes back up to 54-55.00
With bank earnings
From there I expect a bigger correction
Weekly chart says banks won't make it out of July alive . Most likely a sell back to 49-50 or 10% drop
I would say this market would on be bearish with a close back beneath 600.00 on spy.
The problem with that is, not every big tech stock is overbought and some actually look like they are about to rally higher.
Here's an example of what I mean
So here's NASDAQ:SMH or chip sector which is a reflection of Nvda and TSM
Weekly technicals are saying a pullback is coming for this sector!
RSI, Moneyflow are too overbought on both weekly and daily time frames so I'm expecting weakness here over the next few weeks.
On the other hand you have
AMEX:XLY
This is the sector that reflects
Amzn and Tsla
The white line represents the resistance price was consolidating behind for 2months.
The purple circle represents a major bullflag
The green line is the V shape recovery that I think is about to happen with this sector this quarter.
Price may retest 217-218 but if that holds this sector and the stocks in it will outperform.
So what happens with the Spy if let's say you have
Msft
Nvda
Avgo
Tsm
All red
And then
Amzn
Tsla
Googl
Aapl
Mostly green?
Fawkery lol.
And this is why I say a pullback to 610 and then we'll see..
AMEX:IWM and TVC:DJI still have a little room left to move higher but both are supper extended on the daily time frame and I expect a pullback from them this week
There is 2 red flags I see on a bigger time frame and that is TVC:NYA and TVC:VIX
NYA weekly chart
Near the top of rising wedge here which means for the broader marker you will start seeing weakness in a few weeks
Price could grind up here for a few weeks but I doubt we break above 21,000
Vix
Daily chart and RSI
Is screaming that a move to 23 is imminent
If the vix pops back above 20 I can't see the Spy holding above 620
Trade ideas
NASDAQ:TSLA
I like calls above 322.00
Target 332.
Have patience for the move above 322, tsla is beneath all its moving averages right now!.
332 will be tough, if price can break above that then 347 is next up
NASDAQ:QQQ
557 is resistance .
I like the short to 552 gap support. At 552 I'd cover and wait for a break below 548.00 to short to 544..
Below 543.00 and we close gap at 539. I don't think price will drop back below 539 before tech earnings
Be careful about swinging short, it will only work if there is a vicious sell off. Otherwise you will find yourself with annoying small gap ups that will drag this out like I highlighted above on the Spy chart with the last to previous Pullbacks.
So what I'm looking for over the next 2 weeks is a retest for Spy 610 and qqq 540. Then we go into earning season
SPY: Bearish Continuation & Short Trade
SPY
- Classic bearish pattern
- Our team expects retracement
SUGGESTED TRADE:
Swing Trade
Sell SPY
Entry - 625.36
Stop - 633.00
Take - 611.27
Our Risk - 1%
Start protection of your profits from lower levels
Disclosure: I am part of Trade Nation's Influencer program and receive a monthly fee for using their TradingView charts in my analysis.
❤️ Please, support our work with like & comment! ❤️
SPY Under Pressure! SELL!
My dear friends,
Please, find my technical outlook for SPY below:
The instrument tests an important psychological level 625.36
Bias - Bearish
Technical Indicators: Supper Trend gives a precise Bearish signal, while Pivot Point HL predicts price changes and potential reversals in the market.
Target - 610.17
Recommended Stop Loss - 632.61
About Used Indicators:
Super-trend indicator is more useful in trending markets where there are clear uptrends and downtrends in price.
Disclosure: I am part of Trade Nation's Influencer program and receive a monthly fee for using their TradingView charts in my analysis.
———————————
WISH YOU ALL LUCK
SP500: Fib Channels on Fractal Corridors Research Notes
Testing angle of trendline which acts as support then defines resistance.
Structural reference
Pattern expressed in Fibonacci:
Ascending:
Descending:
Fib Channels on Fractal Corridors supposed to show alternative mapping method which differs from following approach.
SPY/QQQ Plan Your Trade End Of Week Update For 7-4Happy 4th of July
I've been very busy with projects and new tools for traders, as well as the new book I'm working on, and thought I would deliver an End Of Week update for everyone.
In this video, I cover the past Cycle Patterns and how they played out for the SPY/QQQ, Gold/Silver, and Bitcoin, as well as add some of my own insight related to the market trends.
All of my systems are still LONG and have not changed. I still believe this market is extremely overbought, and I believe it could roll over at any moment into a pullback - but we need to wait to see if/when that may/does happen.
Gold made a big move higher this week, and I believe that move could continue throughout July.
Bitcoin made a surprising Double-Top and is not rolling downward. Could be a breakdown in the markets as BTCUSD tends to lead the QQQ/NQ by about 3-5 days.
The SPY/QQQ rallied like a rocket all week. It was absolutely incredible to see the markets rally like this. But, I'm still cautious of a sudden rollover top.
I managed to catch some nice trades with options spreads this week, and my metals positions were on fire. I'm still trading from a "hedge everything" mode as I don't trust this rally, and I'm still watching for REJECTIONS near these new highs.
Stay safe and GET SOME.
DM me if you have any questions.
#trading #research #investing #tradingalgos #tradingsignals #cycles #fibonacci #elliotwave #modelingsystems #stocks #bitcoin #btcusd #cryptos #spy #gold #nq #investing #trading #spytrading #spymarket #tradingmarket #stockmarket #silver
Debugging Pine Script with log.info()log.info() is one of the most powerful tools in Pine Script that no one knows about. Whenever you code, you want to be able to debug, or find out why something isn’t working. The log.info() command will help you do that. Without it, creating more complex Pine Scripts becomes exponentially more difficult.
The first thing to note is that log.info() only displays strings. So, if you have a variable that is not a string, you must turn it into a string in order for log.info() to work. The way you do that is with the str.tostring() command. And remember, it's all lower case! You can throw in any numeric value (float, int, timestamp) into str.string() and it should work.
Next, in order to make your output intelligible, you may want to identify whatever value you are logging. For example, if an RSI value is 50, you don’t want a bunch of lines that just say “50”. You may want it to say “RSI = 50”.
To do that, you’ll have to use the concatenation operator. For example, if you have a variable called “rsi”, and its value is 50, then you would use the “+” concatenation symbol.
EXAMPLE 1
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
//@version=6
indicator("log.info()")
rsi = ta.rsi(close,14)
log.info(“RSI= ” + str.tostring(rsi))
Example Output =>
RSI= 50
Here, we use double quotes to create a string that contains the name of the variable, in this case “RSI = “, then we concatenate it with a stringified version of the variable, rsi.
Now that you know how to write a log, where do you view them? There isn’t a lot of documentation on it, and the link is not conveniently located.
Open up the “Pine Editor” tab at the bottom of any chart view, and you’ll see a “3 dot” button at the top right of the pane. Click that, and right above the “Help” menu item you’ll see “Pine logs”. Clicking that will open that to open a pane on the right of your browser - replacing whatever was in the right pane area before. This is where your log output will show up.
But, because you’re dealing with time series data, using the log.info() command without some type of condition will give you a fast moving stream of numbers that will be difficult to interpret. So, you may only want the output to show up once per bar, or only under specific conditions.
To have the output show up only after all computations have completed, you’ll need to use the barState.islast command. Remember, barState is camelCase, but islast is not!
EXAMPLE 2
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
//@version=6
indicator("log.info()")
rsi = ta.rsi(close,14)
if barState.islast
log.info("RSI=" + str.tostring(rsi))
plot(rsi)
However, this can be less than ideal, because you may want the value of the rsi variable on a particular bar, at a particular time, or under a specific chart condition. Let’s hit these one at a time.
In each of these cases, the built-in bar_index variable will come in handy. When debugging, I typically like to assign a variable “bix” to represent bar_index, and include it in the output.
So, if I want to see the rsi value when RSI crosses above 0.5, then I would have something like:
EXAMPLE 3
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
//@version=6
indicator("log.info()")
rsi = ta.rsi(close,14)
bix = bar_index
rsiCrossedOver = ta.crossover(rsi,0.5)
if rsiCrossedOver
log.info("bix=" + str.tostring(bix) + " - RSI=" + str.tostring(rsi))
plot(rsi)
Example Output =>
bix=19964 - RSI=51.8449459867
bix=19972 - RSI=50.0975830828
bix=19983 - RSI=53.3529808079
bix=19985 - RSI=53.1595745146
bix=19999 - RSI=66.6466337654
bix=20001 - RSI=52.2191767466
Here, we see that the output only appears when the condition is met.
A useful thing to know is that if you want to limit the number of decimal places, then you would use the command str.tostring(rsi,”#.##”), which tells the interpreter that the format of the number should only be 2 decimal places. Or you could round the rsi variable with a command like rsi2 = math.round(rsi*100)/100 . In either case you’re output would look like:
bix=19964 - RSI=51.84
bix=19972 - RSI=50.1
bix=19983 - RSI=53.35
bix=19985 - RSI=53.16
bix=19999 - RSI=66.65
bix=20001 - RSI=52.22
This would decrease the amount of memory that’s being used to display your variable’s values, which can become a limitation for the log.info() command. It only allows 4096 characters per line, so when you get to trying to output arrays (which is another cool feature), you’ll have to keep that in mind.
Another thing to note is that log output is always preceded by a timestamp, but for the sake of brevity, I’m not including those in the output examples.
If you wanted to only output a value after the chart was fully loaded, that’s when barState.islast command comes in. Under this condition, only one line of output is created per tick update — AFTER the chart has finished loading. For example, if you only want to see what the the current bar_index and rsi values are, without filling up your log window with everything that happens before, then you could use the following code:
EXAMPLE 4
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
//@version=6
indicator("log.info()")
rsi = ta.rsi(close,14)
bix = bar_index
if barstate.islast
log.info("bix=" + str.tostring(bix) + " - RSI=" + str.tostring(rsi))
Example Output =>
bix=20203 - RSI=53.1103309071
This value would keep updating after every new bar tick.
The log.info() command is a huge help in creating new scripts, however, it does have its limitations. As mentioned earlier, only 4096 characters are allowed per line. So, although you can use log.info() to output arrays, you have to be aware of how many characters that array will use.
The following code DOES NOT WORK! And, the only way you can find out why will be the red exclamation point next to the name of the indicator. That, and nothing will show up on the chart, or in the logs.
// CODE DOESN’T WORK
//@version=6
indicator("MW - log.info()")
var array rsi_arr = array.new()
rsi = ta.rsi(close,14)
bix = bar_index
rsiCrossedOver = ta.crossover(rsi,50)
if rsiCrossedOver
array.push(rsi_arr, rsi)
if barstate.islast
log.info("rsi_arr:" + str.tostring(rsi_arr))
log.info("bix=" + str.tostring(bix) + " - RSI=" + str.tostring(rsi))
plot(rsi)
// No code errors, but will not compile because too much is being written to the logs.
However, after putting some time restrictions in with the i_startTime and i_endTime user input variables, and creating a dateFilter variable to use in the conditions, I can limit the size of the final array. So, the following code does work.
EXAMPLE 5
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CODE DOES WORK
//@version=6
indicator("MW - log.info()")
i_startTime = input.time(title="Start", defval=timestamp("01 Jan 2025 13:30 +0000"))
i_endTime = input.time(title="End", defval=timestamp("1 Jan 2099 19:30 +0000"))
var array rsi_arr = array.new()
dateFilter = time >= i_startTime and time <= i_endTime
rsi = ta.rsi(close,14)
bix = bar_index
rsiCrossedOver = ta.crossover(rsi,50) and dateFilter // <== The dateFilter condition keeps the array from getting too big
if rsiCrossedOver
array.push(rsi_arr, rsi)
if barstate.islast
log.info("rsi_arr:" + str.tostring(rsi_arr))
log.info("bix=" + str.tostring(bix) + " - RSI=" + str.tostring(rsi))
plot(rsi)
Example Output =>
rsi_arr:
bix=20210 - RSI=56.9030578034
Of course, if you restrict the decimal places by using the rounding the rsi value with something like rsiRounded = math.round(rsi * 100) / 100 , then you can further reduce the size of your array. In this case the output may look something like:
Example Output =>
rsi_arr:
bix=20210 - RSI=55.6947486019
This will give your code a little breathing room.
In a nutshell, I was coding for over a year trying to debug by pushing output to labels, tables, and using libraries that cluttered up my code. Once I was able to debug with log.info() it was a game changer. I was able to start building much more advanced scripts. Hopefully, this will help you on your journey as well.