Lunar Signal Generator My Lunar signal generator uses a sinusoidal wave which is matched in frequency to the sinusoidal motion of the moon. The indicator is based on research which suggests that there are increased returns on days surrounding the new moon and decreased returns on days surrounding the full moon.
The indicator represents a two week trading strategy and prints buy signals before the new moon, and prints sell signals on the full moon. If used as a trading strategy the 5 & 10 year win rates are 70%, profitability is dependent on your choice of stoploss. I suggest a 9% Stoploss however this is discretionary. Can be used on any financial product, however it works best on large cap equities.
Just place on any chart, and trade according to the buy and sell signals
Check out my website, (press the little globe below my profile description)
Please reach out for any questions/concerns
Strategy!
OMNICHART presents => NFLX - long term trendNetflix is still in an upward channel - in a long term bullish trend. In the coming months if it meets the support line and bounces off then that would be the time to buy leaps or scale into additional long term positions. Or start scaling in along with a put spread/s until the support line for a year. A tweak in the trade do make additional income would be to sell put at the support line for every week or month and most likely it will expire worth less and then sell a subsequent put (for week or month) at a point higher on the support line , basically keep selling your puts on the support line as time moves along and the price is above the support line. This was you might just cover the price of the long put you bought today and even make additional income. And if the stock goes up you are still making money. This buys you additional protection for free based on how disciplined you are with managing the put spread (especially the short end of it).
Multi-Timeframe XGBoost Approximation Templatewww.tradingview.com
Template Name:XGBoost Approx
Core Idea: This strategy attempts to mimic the output of an XGBoost model (a powerful machine learning algorithm) by combining several common technical indicators with the Rate of Change (ROC) , MACD, RSI and EMA across multiple timeframes. It uses a weighted sum of normalized indicators to generate a "composite indicator," and trades based on this indicator crossing predefined thresholds. The multi-timeframe ROC acts as a trend filter.
Key Features and How They Work:
Multi-Timeframe Analysis (MTF): This is the heart of the strategy. It looks at the price action on three different timeframes:
Trading Timeframe (tradingTF): The timeframe you're actually placing trades on (e.g., 1-minute, 5-minute, 1-hour, etc.). You set this directly in the strategy's settings. This is the most important timeframe.
Lower Timeframe (selectedLTF): A timeframe lower than your trading timeframe. Used to catch early signs of trend changes. The script automatically selects an appropriate lower timeframe based on your trading timeframe. This is primarily used for a more sensitive ROC filter.
Current Timeframe (tradingTF): The strategy uses the current (trading) timeframe, to include it in the ROC filter.
Higher Timeframe (selectedHTF): A timeframe higher than your trading timeframe. Used to confirm the overall trend direction. The script automatically selects this, too. This is the "big picture" timeframe.
The script uses request.security to get data from these other timeframes. The lookahead=barmerge.lookahead_on part is important; it prevents the strategy from "peeking" into the future, which would make backtesting results unrealistic.
Indicators Used:
SMA (Simple Moving Average): Smooths out price data. The strategy calculates a normalized SMA, which essentially measures how far the current SMA is from its own average, in terms of standard deviations.
RSI (Relative Strength Index): An oscillator that measures the speed and change of price movements. Normalized similarly to the SMA.
MACD (Moving Average Convergence Divergence): A trend-following momentum indicator. The strategy uses the difference between the MACD line and its signal line, normalized.
ROC (Rate of Change): Measures the percentage change in price over a given period (defined by rocLength). This is the key indicator in this strategy, and it's used on all three timeframes.
Volume: The strategy considers the change in volume, also normalized. This can help identify strong moves (high volume confirming a price move).
Normalization: Each indicator is normalized. This is done by subtracting the indicator's average and dividing by its standard deviation. Normalization puts all the indicators on a similar scale (roughly between -3 and +3, most of the time), making it easier to combine them with weights.
Weights: The strategy uses weights (e.g., weightSMA, weightRSI, etc.) to determine how much influence each indicator has on the final "composite indicator." These weights are crucial for the strategy's performance. You can adjust them in the strategy's settings.
Composite Indicator: This is the weighted sum of all the normalized indicators. It's the strategy's main signal generator.
Thresholds: The buyThreshold and sellThreshold determine when the strategy enters a trade. When the composite indicator crosses above the buyThreshold, it's a potential buy signal. When it crosses below the sellThreshold, it's a potential sell signal.
Multi-Timeframe ROC Filter: The strategy uses a crucial filter based on the ROC on all selected timeframes. For a long trade, the ROC must be positive on all three timeframes (ltf_roc_long, ctf_roc_long, htf_roc_long must all be true). For a short trade, the ROC must be negative on all three timeframes. This is a strong trend filter.
Timeframe Filter Selection The script intelligently chooses filter timeframes (selectedLTF, selectedHTF) based on the tradingTF you select. This is done by the switch_filter_timeframes function:
Trading Timeframe (tradingTF) Lower Timeframe Filter (selectedLTF) Higher Timeframe Filter (selectedHTF)
1 minute 60 minutes (filterTF1) 60 minutes (filterTF1)
5 minute 240 minutes (filterTF2) 240 minutes (filterTF2)
15 minute 240 minutes (filterTF2) 240 minutes (filterTF2)
30 minute, 60 minute 1 Day (filterTF3) 1 Day (filterTF3)
240 minute (4 hour) 1 Week (filterTF4) 1 Week (filterTF4)
1 Day 1 Month (filterTF5) 1 Month (filterTF5)
1 Week 1 Month (filterTF5) 1 Month (filterTF5)
How to Use and Optimize the Strategy (Useful Hints):
Backtesting: Always start by backtesting on historical data. TradingView's Strategy Tester is your best friend here. Pay close attention to:
Net Profit: The most obvious metric.
Max Drawdown: The largest peak-to-trough decline during the backtest. This tells you how much you could potentially lose.
Profit Factor: Gross profit divided by gross loss. A value above 1 is desirable.
Win Rate: The percentage of winning trades.
Sharpe Ratio: Risk-adjusted return. A Sharpe Ratio above 1 is generally considered good.
**Sortino Ratio:**Similar to Sharpe but it only takes the standard deviation of the downside risk.
Timeframe Selection: Experiment with different tradingTF values. The strategy's performance will vary greatly depending on the timeframe. Consider the asset you're trading (e.g., volatile crypto vs. a stable stock index). The preconfigured filters are a good starting point.
Weight Optimization: This is where the real "tuning" happens. The default weights are just a starting point. Here's a systematic approach:
Start with the ROC Weights: Since this is a ROC-focused strategy, try adjusting weightROC_LTF, weightROC_CTF, and weightROC_HTF first. See if increasing or decreasing their influence improves results.
Adjust Other Weights: Then, experiment with weightSMA, weightRSI, weightMACD, and weightVolume. Try setting some weights to zero to see if simplifying the strategy helps.
Use TradingView's Optimization Feature: The Strategy Tester has an optimization feature (the little gear icon). You can tell it to test a range of values for each weight and see which combination performs best. Be very careful with optimization. It's easy to overfit to past data, which means the strategy will perform poorly in live trading.
Walk-Forward Optimization: A more robust form of optimization. Instead of optimizing on the entire dataset, you optimize on a smaller "in-sample" period, then test on a subsequent "out-of-sample" period. This helps prevent overfitting. TradingView doesn't have built-in walk-forward optimization, but you can do it manually.
Threshold Adjustment: Experiment with different buyThreshold and sellThreshold values. Making them more extreme (further from zero) will result in fewer trades, but potentially higher-quality signals.
Filter Control (useLTFFilter, useCTFFilter, useHTFFilter): These booleans allow you to enable or disable the ROC filters for each timeframe. You can use this to simplify the strategy or test the importance of each filter. For example, you could try disabling the lower timeframe filter (useLTFFilter = false) to see if it makes the strategy more robust.
Asset Selection: This strategy may perform better on some assets than others. Try it on different markets (stocks, forex, crypto, etc.) and different types of assets within those markets.
Risk Management:
pyramiding = 0: This prevents the strategy from adding to existing positions. This is generally a good idea for beginners.
default_qty_type = strategy.percent_of_equity and default_qty_value = 100: This means the strategy will risk 100% of your equity on each trade. This is extremely risky! Change this to a much smaller percentage, like 1 or 2. You should never risk your entire account on a single trade.
Save Trading
Always use a demo account first.
Use a small percentage of equity.
Use a stop-loss and take-profit orders.
Example Optimization Workflow:
Set tradingTF: Choose a timeframe, e.g., 15 (15 minutes).
Initial Backtest: Run a backtest with the default settings. Note the results.
Optimize ROC Weights: Use TradingView's optimization feature to test different values for weightROC_LTF, weightROC_CTF, and weightROC_HTF. Keep the other weights at their defaults for now.
Optimize Other Weights: Once you have a good set of ROC weights, optimize the other weights one at a time. For example, optimize weightSMA, then weightRSI, etc.
Adjust Thresholds: Experiment with different buyThreshold and sellThreshold values.
Out-of-Sample Testing: Take the best settings from your optimization and test them on a different period of historical data (data that wasn't used for optimization). This is crucial to check for overfitting.
Filter Testing: Systematically enable/disable the time frame filters (useLTFFilter, useCTFFilter, useHTFFilter) to see how each impacts performance.
CAD/JPY Analysis – Key Levels & Market Drivers📉 Bearish Context & Key Resistance Levels:
Major Resistance at 108.32
Price previously rejected from this strong supply zone.
Moving averages (yellow & red lines) are acting as dynamic resistance.
Short-term Resistance at 106.00-107.00
Failed bullish attempt, leading to a strong reversal.
A break above this area is needed to shift momentum bullishly.
📈 Bullish Context & Key Support Levels:
Support at 102.00-101.50 (Demand Zone)
Significant buyer interest in this area.
If the price reaches this zone, a potential bounce could occur.
Deeper Support at 99.00-100.00
If 102.00 fails, the next demand level is in the high 90s, marking a critical long-term support.
📉 Current Market Outlook:
CAD/JPY is in a strong downtrend, consistently making lower highs and lower lows.
The price is testing key support areas, and further movement depends on upcoming economic events.
A potential bounce could occur at 102.00, but failure to hold could trigger further declines toward 99.00.
📰 Fundamental Analysis & Market Drivers
🔹 Bank of Canada (BoC) Interest Rate Decision – March 12, 2025
Expected rate cut from 3.00% to 2.75% → Bearish for CAD.
A dovish stance signals weakness in the Canadian economy, potentially pushing CAD/JPY lower.
If the BoC provides an aggressive rate cut or hints at further easing, the downtrend could continue.
🔹 Japan Current Account (January) – March 7, 2025
Expected at 370B JPY (significantly lower than previous 1077.3B JPY).
A lower-than-expected surplus may weaken JPY, slightly offsetting CAD weakness.
If JPY remains strong despite this data, CAD/JPY could fall further toward 101.50-100.00.
📈 Potential Trading Setups:
🔻 Short Setup (Bearish Bias):
Entry: Below 103.00, confirming further weakness.
Target 1: 102.00
Target 2: 100.00
Stop Loss: Above 104.50 to avoid volatility spikes.
🔼 Long Setup (Bullish Scenario - Retracement Play):
Entry: Strong bullish rejection from 102.00
Target 1: 105.00
Target 2: 108.00
Stop Loss: Below 101.50 to limit downside risk.
📌 Final Thoughts:
The BoC rate decision will likely be bearish for CAD, increasing downward pressure on CAD/JPY.
The Japan Current Account data could provide temporary support for JPY but is unlikely to fully reverse the trend.
102.00-101.50 is a key buying zone, while failure to hold could drive the pair toward 99.00-100.00.
🚨 Key Watch Zones: 102.00 Support & 108.00 Resistance – Strong moves expected!
LFWD Lifeward Options Ahead of EarningsAnalyzing the options chain and the chart patterns of LFWD Lifeward prior to the earnings report this week,
I would consider purchasing the 2.50usd strike price Calls with
an expiration date of 2025-7-18,
for a premium of approximately $0.50.
If these options prove to be profitable prior to the earnings release, I would sell at least half of them.
XAU/USD Analysis & Market Insights📉 Bearish Context & Key Resistance Levels:
Major Resistance at 2,934.00
Strong supply zone where price has previously rejected.
Multiple tests of this area indicate seller pressure.
Short-term Resistance at 2,920-2,925
Price is consolidating near this zone.
A rejection could lead to a downward move.
📈 Bullish Context & Key Support Levels:
Support at 2,846.88 - 2,832.72 (Demand Zone)
Strong reaction zone where buyers stepped in.
Previous price action suggests liquidity in this area.
Deeper Support at 2,720-2,680
If 2,832 breaks, this is the next key demand area.
Aligned with moving averages, adding confluence.
📉 Current Market Outlook:
Price recently bounced from the 2,846-2,832 support, showing buyers’ presence.
However, the 2,920-2,925 area is acting as resistance.
If the price fails to break higher, a move back toward 2,846 or even 2,720 is possible.
📈 Potential Trading Setups:
🔻 Short Setup (Bearish Bias):
Entry: Below 2,920 after a clear rejection.
Target 1: 2,846
Target 2: 2,832, with possible extension to 2,720.
Stop Loss: Above 2,935 to avoid fakeouts.
🔼 Long Setup (Bullish Scenario):
Entry: Break and hold above 2,934.00 with confirmation.
Target 1: 2,960
Target 2: 3,000+
Stop Loss: Below 2,915 to minimize risk.
📰 Fundamental Analysis & Market Drivers
1️⃣ US ISM Services PMI & ADP Jobs Report:
The ISM Services PMI increased to 53.5, signaling stronger services inflation and employment.
However, the ADP Employment Report showed a disappointing 77K jobs, far below the expected 140K, weighing on the USD.
2️⃣ Trump’s Tariffs & USD Weakness:
Trump announced massive tariffs on trade partners, affecting risk sentiment.
While he downplayed negative effects, US Commerce Secretary Howard Lutnick hinted at potential tariff rollbacks, boosting risk appetite.
This weakened the USD, allowing gold to rise.
3️⃣ Upcoming ECB Decision:
The ECB is expected to cut rates by 25 bps on Thursday, which could further impact market sentiment and gold’s direction.
If the rate cut weakens the EUR, gold could see more upside.
📌 Final Thoughts:
2,920-2,925 remains a key resistance for short-term direction.
A break above 2,934 could signal bullish continuation.
A rejection from current levels could push price back toward 2,846 or lower.
Fundamentals favor gold's strength as the USD weakens due to poor job data and trade uncertainty.
🚀 Key Decision Zone: Watch price action near 2,920-2,925!
Effective inefficiencyStop-Loss. This combination of words sounds like a magic spell for impatient investors. It's really challenging to watch your account get smaller and smaller. That's why people came up with this magic amulet. Go to the market, don't be afraid, just put it on. Let your profits run, but limit your losses - place a Stop-Loss order.
Its design is simple: when the paper loss reaches the amount agreed upon with you in advance, your position will be closed. The paper loss will become real. And here I have a question: “ Does this invention stop the loss? ” It seems that on the contrary - you take it with you. Then it is not a Stop-Loss, but a Take-Loss. This will be more honest, but let's continue with the classic name.
Another thing that always bothered me was that everyone has their own Stop-Loss. For example, if a company shows a loss, I can find out about it from the reports. Its meaning is the same for everyone and does not depend on those who look at it. With Stop-Loss, it's different. As many people as there are Stop-Losses. There is a lot of subjectivity in it.
For adherents of fundamental analysis, all this looks very strange. I cannot agree that I spent time researching a company, became convinced of the strength of its business, and then simply quoted a price at which I would lock in my loss. I don't think Benjamin Graham would approve either. He knew better than anyone that the market loved to show off its madness when it came to stock prices. So Stop-Loss is part of this madness?
Not quite so. There are many strategies that do not rely on fundamental analysis. They live by their own principles, where Stop-Loss plays a key role. Based on its size relative to the expected profit, these strategies can be divided into three types.
Stop-Loss is approximately equal to the expected profit size
This includes high-frequency strategies of traders who make numerous trades during the day. These can be manual or automated operations. Here we are talking about the advantages that a trader seeks to gain, thanks to modern technical means, complex calculations or simply intuition. In such strategies, it is critical to have favorable commission conditions so as not to give up all the profits to maintaining the infrastructure. The size of profit and loss per trade is approximately equal and insignificant in relation to the size of the account. The main expectation of a trader is to make more positive trades than negative ones.
Stop-Loss is several times less than the expected profit
The second type includes strategies based on technical analysis. The number of transactions here is significantly less than in the strategies of the first type. The idea is to open an interesting position that will show enough profit to cover several losses. This could be trading using chart patterns, wave analysis, candlestick analysis. You can also add buyers of classic options here.
Stop-Loss is an order of magnitude greater than the expected profit
The third type includes arbitrage strategies, selling volatility. The idea behind such strategies is to generate a constant, close to fixed, income due to statistically stable patterns or extreme price differences. But there is also a downside to the coin - a significant Stop-Loss size. If the system breaks down, the resulting loss can cover all the earned profit at once. It's like a deposit in a dodgy bank - the interest rate is great, but there's also a risk of bankruptcy.
Reflecting on these three groups, I formulated the following postulate: “ In an efficient market, the most efficient strategies will show a zero financial result with a pre-determined profit to loss ratio ”.
Let's take this postulate apart piece by piece. What does efficient market mean? It is a stock market where most participants instantly receive information about the assets in question and immediately decide to place, cancel or modify their order. In other words, in such a market, there is no lag between the appearance of information and the reaction to it. It should be said that thanks to the development of telecommunications and information technologies, modern stock markets have significantly improved their efficiency and continue to do so.
What is an effective strategy ? This is a strategy that does not bring losses.
Profit to loss ratio is the result of profitable trades divided by the result of losing trades in the chosen strategy, considering commissions.
So, according to the postulate, one can know in advance what this ratio will be for the most effective strategy in an effective market. In this case, the financial result for any such strategy will be zero.
The formula for calculating the profit to loss ratio according to the postulate:
Profit : Loss ratio = %L / (100% - %L)
Where %L is the percentage of losing trades in the strategy.
Below is a graph of the different ratios of the most efficient strategy in an efficient market.
For example, if your strategy has 60% losing trades, then with a profit to loss ratio of 1.5:1, your financial result will be zero. In this example, to start making money, you need to either reduce the percentage of losing trades (<60%) with a ratio of 1.5:1, or increase the ratio (>1.5), while maintaining the percentage of losing trades (60%). With such improvements, your point will be below the orange line - this is the inefficient market space. In this zone, it is not about your strategy becoming more efficient, you have simply found inefficiencies in the market itself.
Any point above the efficient market line is an inefficient strategy . It is the opposite of an effective strategy, meaning it results in an overall loss. Moreover, an inefficient strategy in an efficient market makes the market itself inefficient , which creates profitable opportunities for efficient strategies in an inefficient market. It sounds complicated, but these words contain an important meaning - if someone loses, then someone will definitely find.
Thus, there is an efficient market line, a zone of efficient strategies in an inefficient market, and a zone of inefficient strategies. In reality, if we mark a point on this chart at a certain time interval, we will get rather a cloud of points, which can be located anywhere and, for example, cross the efficient market line and both zones at the same time. This is due to the constant changes that occur in the market. It is an entity that evolves together with all participants. What was effective suddenly becomes ineffective and vice versa.
For this reason, I formulated another postulate: “ Any market participant strives for the effectiveness of his strategy, and the market strives for its own effectiveness, and when this is achieved, the financial result of the strategy will become zero ”.
In other words, the efficient market line has a strong gravity that, like a magnet, attracts everything that is above and below it. However, I doubt that absolute efficiency will be achieved in the near future. This requires that all market participants have equally fast access to information and respond to it effectively. Moreover, many traders and investors, including myself, have a strong interest in the market being inefficient. Just like we want gravity to be strong enough that we don't fly off into space from our couches, but gentle enough that we can visit the refrigerator. This limits or delays the transfer of information to each other.
Returning to the topic of Stop-Loss, one should pay attention to another pattern that follows from the postulates of market efficiency. Below, on the graph (red line), you can see how much the loss to profit ratio changes depending on the percentage of losing trades in the strategy.
For me, the values located on the red line are the mathematical expectation associated with the size of the loss in an effective strategy in an effective market. In other words, those who have a small percentage of losing trades in their strategy should be on guard. The potential loss in such strategies can be several times higher than the accumulated profit. In the case of strategies with a high percentage of losing trades, most of the risk has already been realized, so the potential loss relative to the profit is small.
As for my attitude towards Stop-Loss, I do not use it in my stock market investing strategy. That is, I don’t know in advance at what price I will close the position. This is because I treat buying shares as participating in a business. I cannot accept that when crazy Mr. Market knocks on my door and offers a strange price, I will immediately sell him my shares. Rather, I would ask myself, “ How efficient is the market right now and should I buy more shares at this price? ” My decision to sell should be motivated not only by the price but also by the fundamental reasons for the decline.
For me, the main criterion for closing a position is the company's profitability - a metric that is the same for everyone who looks at it. If a business stops being profitable, that's a red flag. In this case, the time the company has been in a loss-making state and the size of the losses are considered. Even a great company can have a bad quarter for one reason or another.
In my opinion, the main work with risks should take place before the company gets into the portfolio, and not after the position is opened. Often it doesn't even involve fundamental business analysis. Here are four things I'm talking about:
- Diversification. Distribution of investments among many companies.
- Gradually gaining position. Buying stocks within a range of prices, rather than at one desired price.
- Prioritization of sectors. For me, sectors of stable consumer demand always have a higher priority than others.
- No leverage.
I propose to examine the last point separately. The thing is that the broker who lends you money is absolutely right to be afraid that you won’t pay it back. For this reason, each time he calculates how much his loan is secured by your money and the current value of the shares (that is, the value that is currently on the market). Once this collateral is not enough, you will receive a so-called margin call . This is a requirement to fund an account to secure a loan. If you fail to do this, part of your position will be forcibly closed. Unfortunately, no one will listen to the excuse that this company is making a profit and the market is insane. The broker will simply give you a Stop-Loss. Therefore, leverage, by its definition, cannot be used in my investment strategy.
In conclusion of this article, I would like to say that the market, as a social phenomenon, contains a great paradox. On the one hand, we have a natural desire for it to be ineffective, on the other hand, we are all working on its effectiveness. It turns out that the income we take from the market is payment for this work. At the same time, our loss can be represented as the salary that we personally pay to other market participants for their efficiency. I don't know about you, but this understanding seems beautiful to me.
[03/03] SPY GEX Analysis (Until Friday Expiration)Overall Sentiment:
Currently, there’s a positive GEX sentiment, suggesting an optimistic start to the week following Friday’s bounce. However, the key Call resistance appears at 600, and it may not break on the first attempt. If optimism remains strong, there’s a chance SPY 0.09%↑ could still push above that zone after some initial back-and-forth.
🟢Upside Levels:
600–605 Zone: This is a major resistance area. Should SPY move decisively through 600/605, the next potential target could be 610.
610: This is currently the largest positive GEX zone for the week. Current option pricing suggests only about a 9% chance of closing at or above 610 by Friday, so it might require a particularly strong move to break through.
🔵 Transition Zone: Roughly 592–599. The gamma flip level is near 592, and staying above that keeps the market in a positive gamma range for now.
🔴 Downside Risk:
If 592 Fails (or HVL climbing up during the week, and after that HVL fails…): A drop could accelerate toward 585, which may act as the first take-profit zone for bears. Below that, 580 could be in play if selling intensifies.
Lower Support: 575 is the last strong support mentioned, but current option probabilities suggest about an 88% chance of finishing above that level, making a move below 575 less likely—though still possible given the higher put skew.
🟣Volatility & Skew:
IVR (Implied Volatility Rank) is quite high on SPY, with a notable put pricing skew (around 173.1%).
This heightened put skew indicates the market is pricing in faster, more volatile downward moves compared to upside.
MSTR IS JUST GETTING STARTED - ONLY FOOLS SELL NOW!MSTR and Bitcoin are gearing up for the biggest bull run you've ever seen. Its unbelievable how many people are selling now thinking the bear market is starting and the bull run is over. Its crazy how many bears are flooding X and other platforms. It makes me laugh people calling Saylor a top signal and stupid. Saylor is not stupid and to think that you're smarter than him is just dumb. These rich dudes and hedge funds know whats going on, way better than anyone on here or any other platform. They control the markets, they have the money to make the charts do what they want. Dont be fooled.
None of this is financial advice. Just my opinion. Follow me for more charts and updates.
How to develop a simple Buy&Sell strategy using Pine ScriptIn this article, will explain how to develop a simple backtesting for a Buy&Sell trading strategy using Pine Script language and simple moving average (SMA).
Strategy description
The strategy illustrated works on price movements around the 200-period simple moving average (SMA). Open long positions when the price crossing-down and moves below the average. Close position when the price crossing-up and moves above the average. A single trade is opened at a time, using 5% of the total capital.
Behind the code
Now let's try to break down the logic behind the strategy to provide a method for properly organizing the source code. In this specific example, we can identify three main actions:
1) Data extrapolation
2) Researching condition and data filtering
3) Trading execution
1. GENERAL PARAMETERS OF THE STRATEGY
First define the general parameters of the script.
Let's define the name.
"Buy&Sell Strategy Template "
Select whether to show the output on the chart or within a dashboard. In this example will show the output on the chart.
overlay = true
Specify that a percentage of the equity will be used for each trade.
default_qty_type = strategy.percent_of_equity
Specify percentage quantity to be used for each trade. Will be 5%.
default_qty_value = 5
Choose the backtesting currency.
currency = currency.EUR
Choose the capital portfolio amount.
initial_capital = 10000
Let's define percentage commissions.
commission_type = strategy.commission.percent
Let's set the commission at 0.07%.
commission_value = 0.07
Let's define a slippage of 3.
slippage = 3
Calculate data only when the price is closed, for more accurate output.
process_orders_on_close = true
2. DATA EXTRAPOLATION
In this second step we extrapolate data from the historical series. Call the calculation of the simple moving average using close price and 200 period bars.
sma = ta.sma(close, 200)
3. DEFINITION OF TRADING CONDITIONS
Now define the trading conditions.
entry_condition = ta.crossunder(close, sma)
The close condition involves a bullish crossing of the closing price with the average.
exit_condition = ta.crossover(close, sma)
4. TRADING EXECUTION
At this step, our script will execute trades using the conditions described above.
if (entry_condition==true and strategy.opentrades==0)
strategy.entry(id = "Buy", direction = strategy.long, limit = close)
if (exit_condition==true)
strategy.exit(id = "Sell", from_entry = "Buy", limit = close)
5. DESIGN
In this last step will draw the SMA indicator, representing it with a red line.
plot(sma, title = "SMA", color = color.red)
Complete code below.
//@version=6
strategy(
"Buy&Sell Strategy Template ",
overlay = true,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 5,
currency = currency.EUR,
initial_capital = 10000,
commission_type = strategy.commission.percent,
commission_value = 0.07,
slippage = 3,
process_orders_on_close = true
)
sma = ta.sma(close, 200)
entry_condition = ta.crossunder(close, sma)
exit_condition = ta.crossover(close, sma)
if (entry_condition==true and strategy.opentrades==0)
strategy.entry(id = "Buy", direction = strategy.long, limit = close)
if (exit_condition==true)
strategy.exit(id = "Sell", from_entry = "Buy", limit = close)
plot(sma, title = "SMA", color = color.red)
The completed script will display the moving average with open and close trading signals.
IMPORTANT! Remember, this strategy was created for educational purposes only. Not use it in real trading.
$3.35 to $8.50 New highs power vertical predicted from lows$3 to $8+ 🚀 New highs power vertical predicted from lows after shortseller manipulation trick on NASDAQ:ACON
4 Buy Alerts sent our along with multiple chat messages confirming the expected move
It closed the day at highs looking good for continuation tomorrow
Strategy Development: Price Levels & Time ProcessingI’m currently working on a trading script designed to identify optimal stop-loss and take-profit levels based on market structure and volatility.
Day TF
Short entry: $101,460.15 with a stop-loss at $105,330.08
TP levels tested down to $82,110
Despite it played out ok I still need additional validation that will come with time. Point is to keep enhancing the script so most of the time price does not pass 5th take profit considering latest periods between consecutive Long & Short signals.
3H TF
Alternatively, I picked different timeframe for another layer of performance evaluation from another perspective.
Long entry: $84,201.84 with a stop-loss at $82,967.61
TP levels tested up to $90,372.97
Blue TP means the closing price reached the level, while gray - did not.
⏱ TIMING
Many traders focus on price levels but overlook the time duration between long and short signals. However, understanding how long trends last is just as crucial as knowing where price might go.
Why does this matter?
If your strategy enters a long trade too soon after a short trade, you might be catching a dead-cat bounce rather than a real reversal.
If your signals occur too frequently, the system may be overreacting to market noise rather than identifying meaningful trend shifts.
Tracking the duration of trend phases helps you align with market cycles rather than getting whipsawed by short-term fluctuations.
The results will be viewed carefully and will be used to improve the logic (code-wise) for better trend detection; stop-loss placements to avoid unnecessary stop-outs; refined entry timing.
The end goal is to make the strategy learn from both aspects of past data - price and time to completely eliminate a need for any user inputs.
Please, let me know:
How you incorporate time-based analysis (other than fixed cycles) into your trading.
If you would want this strategy available for public.
GEO The GEO Group Options Ahead of Earnings If you haven`t bought the dip on GEO:
Now analyzing the options chain and the chart patterns of GEO The GEO Group prior to the earnings report this week,
I would consider purchasing the 26usd strike price Calls with
an expiration date of 2025-4-17,
for a premium of approximately $3.10.
If these options prove to be profitable prior to the earnings release, I would sell at least half of them.
Microstrategy Enters "The Valley of Risk"A term I have coined, "The Valley of Risk", describes a price chart which has had a prior very strong bullish trend, pulls back to its 50% Retracement Support, and then fails to hold it... entering a long, grinding, bearish deflation which coincides with the heavy negative emotion being felt by those still holding the bag.
Inside the "Valley of Risk" nothing one does is correct:
If you sell... it will bottom and rally
If you buy... it will continue down
If you baghold... it will continue to go down until you cannot stand it and #1
This is just a pattern of human emotion being reflected on a price chart... which is what price charts ultimately are. It is best to avoid going into the Valley of Risk and have strict rules against bagholding. Deploy your capital elsewhere that there is a better potential rate of return.
When I teach about this concept I always look back to Zillow NASDAQ:Z . This was a stock I bought "on a dip" at 111 and made the right decision to sell my position at a loss at 102 when the stock price violated the 50% Support. This allowed me to avoid the horrible Earnings miss gap and the final -74% depreciation. My position still would not have recovered as of writing.
As I published months ago, it became clear to me that the over exuberance and fancy financial buzz words being thrown around about NASDAQ:MSTR were signs of a ponzi about to collapse. Well, the "Bitcoin nuclear reactor" has cooled and the leverage baked into Microstrategy would be its downfall. That has now come to pass. There are some other interesting elements of price action which have been textbook in this decline that I want to talk about in this post.
The 50% Retracement:
The operative level for the last 3 months has been 328. This is the 50% Retracement of the YOLO rally. In the pullback from the ATH 440 became the 50% Retracement Resistance.
The Ichimoku Cloud Breakout Confirmed:
The other textbook setup was when the Ichimoku Cloud Breakout was confirmed by the Lagging Span entering clear bearish space after price had exited the cloud. Interestingly, this happened at the same exact day as Bitcoin; last Friday. You can read more about this strategy and my 14 year study of how effective it is in my recent Ideas:
So what now?
That is the eternal question of "The Valley of Risk". There is never a good answer because the technical supports have been broken.
Personally though I need to answer this question for my bearish positions. The most logical point to look would be the Volume Profile POC at 165. However, Microstrategy is going to move concurrent to Bitcoin itself and knowing the past bearish cycle patterns this week, through brutal, will find a bottom. I do not believe it will be the final bottom only that price may hesitate at some point for perhaps even a month.
My trade management
This week I will be selling premium against my long Puts, which go out to 2027, to offset my Theta while still remaining short Delta.
Bollinger Bands: Basics and Breakout Strategy🔵 What are Bollinger Bands?
Bollinger Bands are a popular technical analysis tool developed by John Bollinger in the early 1980s. They help traders analyze price volatility and potential price levels for buying or selling. The indicator consists of three lines plotted over a price chart:
Middle Band: A simple moving average (SMA), typically set to a 20-period average.
Upper Band: The middle band plus two standard deviations.
Lower Band: The middle band minus two standard deviations.
🔵 How Are Bollinger Bands Calculated?
Middle Band (MB): MB = 20-period SMA of the closing price.
Upper Band (UB): UB = MB + (2 × standard deviation of the last 20 periods).
Lower Band (LB): LB = MB - (2 × standard deviation of the last 20 periods).
The bands expand when volatility increases and contract when volatility decreases.
length = 20
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
🔵 How to Use Bollinger Bands in Trading
Bollinger Bands provide insights into market volatility and potential price reversals. Traders often use them to:
Identify overbought (price near the upper band) and oversold (price near the lower band) conditions.
Spot volatility contractions, which often precede significant price moves.
Confirm trend strength and potential reversals.
🔵 Bollinger Bands Breakout Strategy
One effective strategy involves preparing for breakouts when the upper and lower bands contract, indicating low price momentum.
Strategy Steps:
Identify Low Volatility Zones: Look for periods when the bands are close together, signaling a potential breakout.
Prepare for a Breakout: Monitor price action as it approaches either the upper or lower band.
Entry Signal: Enter a trade when the price closes above the upper band (for a long position) or below the lower band (for a short position).
Stop Loss Placement:
For long entries (break above upper band): Set stop loss at the lower band.
For short entries (break below lower band): Set stop loss at the upper band.
Profit Target: Use a risk-reward ratio of at least 1:2 or close the position when price shows signs of reversal.
Example Charts:
🔵 Final Thoughts
This Bollinger Bands breakout strategy is simple yet effective. By recognizing periods of low volatility and preparing for breakouts, traders can capitalize on significant price movements. Always complement this strategy with proper risk management and confirmation indicators for optimal results.
This article is for informational purposes only and should not be considered financial advice. Trading involves risk, and traders are solely responsible for their own decisions and actions.
EUR/USD Faces Key Resistance Amid Liquidity Grab ExpectationsEUR/USD is undergoing a pullback after reaching a one-month high of 1.0528, closing at 1.04658 on February 24, marking a 0.22% decline from the previous day. The euro's recent strength was driven by post-election stability in Germany, where centrist parties formed a coalition government, boosting market confidence. However, bullish momentum has stalled near key resistance levels around 1.0530 and 1.0560, with the pair struggling to sustain gains above the 100-day simple moving average.
From a technical standpoint, the price is approaching a significant supply zone, where a liquidity grab could occur before a potential downside move. Resistance in this area aligns with broader concerns over Germany's economic outlook and coalition negotiations, which could weaken the euro’s appeal. Meanwhile, the U.S. dollar, despite recent weakness due to declining consumer confidence, remains in a favorable position for a short-term recovery, adding further pressure on EUR/USD.
If the pair fails to break through resistance, a rejection could trigger a decline toward 1.0400, with further downside potential extending to 1.0283. Conversely, if buyers manage to push past the liquidity zone, the next upside targets lie at 1.0530 and 1.0560.
GBP/USD: Bullish Momentum Faces Key ResistanceGBP/USD has reached its highest point since mid-December at 1.2690, primarily driven by the weakness of the US dollar. The pair has shown strong momentum, and as long as it holds above the key support at 1.2520, analysts see potential for further upside toward 1.2725. Positive UK economic data, including better-than-expected retail sales and inflation figures, have reinforced a bullish outlook for the pound. However, minor retracements have been observed, with slight declines following recent gains, such as the 0.05% drop on February 24. Market volatility remains a factor, with geopolitical tensions and fluctuating commodity prices impacting the dollar’s strength. From a technical standpoint, the price is currently testing a resistance zone while approaching key moving averages, which could act as dynamic resistance. The presence of supply zones above suggests that the pair could face selling pressure before a potential continuation higher. If the price fails to sustain above the resistance area, a retracement toward the 1.2520 level and possibly deeper into the 1.2400 region could materialize. Despite the recent bullish momentum, caution is warranted due to broader market uncertainties, and future movements will depend on economic indicators from both the UK and the US, as well as overall market sentiment.
EUR/GBP: Key Support Test Amid Bearish PressureThe analysis of EUR/GBP as of February 24, 2025, presents an interesting technical outlook. The price is testing a key support area around 0.8297 after a modest recovery from the 0.8271 lows. The current setup suggests a potential reaction in this zone, with the possibility of a technical rebound towards higher levels or a more significant bearish breakdown.
From a technical perspective, several key areas stand out: the upper resistance in the 0.8440-0.8460 range represents a critical level for a bullish recovery, while the lower support around 0.8265-0.8240 could act as a catalyst for further downside momentum if broken. Moving average analysis indicates persistent bearish pressure, with both the 50 and 200-period moving averages sloping downward. This reinforces the idea that, despite recent rebounds, the dominant trend remains bearish in the medium term.
From a macroeconomic standpoint, expectations regarding the UK and Eurozone economic outlook are shaping the pair's direction. UK inflation is showing signs of recovery, providing some support for the pound, but uncertainties related to economic growth and Bank of England policies could hinder a sustained strengthening of the British currency. On the other hand, the Eurozone is facing challenges linked to growth stagnation, and the ECB may maintain an accommodative policy to stimulate the economy. These factors create an unstable balance that could lead to heightened volatility in the coming days.
Technical forecasts suggest two possible scenarios: a temporary rebound towards 0.8340-0.8360 before another test of the lows or a direct break below 0.8265, which could open the door for a decline towards 0.8240-0.8220.
GOLD| Approaching Historic Highs Amid Geopolitical UncertaintyThe analysis of XAU/USD highlights a strong bullish trend, closing at approximately $2,939.41 on February 20, 2025, marking a 0.23% increase from the previous day. The recent high of $2,946.83 on February 19 indicates continued positive momentum, driven by geopolitical tensions, inflation concerns, and fears of potential trade wars, all of which have strengthened gold’s status as a safe-haven asset. The current momentum has pushed prices toward historic levels, with the potential to surpass $3,000, supported by a weaker U.S. dollar and declining U.S. yields. The chart shows a key resistance zone around $2,960, with a potential retracement towards the $2,880 area, identified as the first major support level. The current price action suggests a possible pullback before another breakout attempt. If the price consolidates above $2,900, it could accelerate towards new highs, while a break below $2,880 may drive the price toward the next support level around $2,840. The overall outlook remains bullish, with investor interest fueled by global uncertainties and the increasing demand for gold as a hedge against economic risks.