Cerca negli script per "中海油+10年股价涨幅"
Guppy MMA 3, 5, 8, 10, 12, 15 and 30, 35, 40, 45, 50, 60Guppy Multiple Moving Average
Short Term EMA 3, 5, 8, 10, 12, 15
Long Term EMA 30, 35, 40, 45, 50, 60
Use for SFTS Class
10-2 Year Treasury Yield Spread by zdmreLong-term bond yield reflects inflation. Short-term bond yields are tools used to predict Fed's interest rate policy. Spread between the two represents four cycles of an economy.
1. Growth
Short-term yield rises as interest rates rise. Spread narrows.
2. Slow growth
Central bank raises interest rates faster and short-term yield exceeds long-term yield. Spread turns negative.
3. Recession
High interest rates lead to more defaults. Inflation caps consumption. Central bank lowers interest rate to stimulate the economy and short-term yield falls. Spread widens.
4. Recovery
Central bank continues easing. Spread remains wide and yield curve remains steep.
0 = Recession Risk
2.6 = Recovery Plan
DYOR
6 Figures Scalping 2x MACD10-11-2019
This script plots a double MACD in a new indicator pane
The default settings:
Pink = STD MACD , settings 12-26-9
Green - Fast MACD, settings 5-15-1
The MACD settings can be changed in the indicators setting window
10/20/50/100/200 SMA'sMultiple MA's to get a good feel for momentum and interim supports and resistances
Moving Average x10 (SMA, EMA)10 configurable Simple and Exponential moving averages combined in one indicator
SMA RIBBON10 SMA's arranged in a ribbon. Color coded depending on price close. Free to use, open source. As seen in some charts.
10Y Bond Yield Spread (beta)10-Year Bond Yield Spread using Quandl data
See also:
- seekingalpha.com
- www.babypips.com
- www.forexfactory.com
10 Simple & 6 Exponential Moving Averages (w/ 18 day,week,month)* This is for the trader who wants tons of moving averages on their chart from one indicator
* Using the options, you should be able ot turn off some of them if the screen is too noisy for you
* You should also be able to change colors and thickness of the bars
* The thicker bars are for longer term averages
* This version is similar to my other script except it adds the 18 day, 18 week, and 18 Month SMa
* I added them after watching ira Epstein's YouTube videos
* Let me know if there are any bugs or things that need to be change
MA Crossover Strategy with TP/SL (5 EMA Filter)How the Strategy Works on a 5-Minute Chart:
Data Input (5-Minute Candles):
Every single data point (candle) on your chart will represent 5 minutes of price action (Open, High, Low, Close for that 5-minute period).
All calculations (MAs, EMA, signals) will be based on these 5-minute price data points.
Moving Average Calculations:
Fast MA (10-period SMA): This will be the Simple Moving Average of the closing prices of the last 10 five-minute candles. It reacts relatively quickly to recent price changes.
Slow MA (30-period SMA): This will be the Simple Moving Average of the closing prices of the last 30 five-minute candles. It represents a slightly longer-term trend compared to the Fast MA.
5 EMA (5-period EMA): This is the Exponential Moving Average of the closing prices of the last 5 five-minute candles. Being an EMA, it gives more weight to the most recent 5-minute prices, making it very responsive to immediate price action.
Signal Generation (Entry Conditions):
Long Entry Signal:
The 10-period SMA crosses above the 30-period SMA (indicating a potential bullish shift in the short-to-medium term trend).
AND the current 5-minute candle's closing price is above the 5-period EMA (confirming that the immediate price momentum is also bullish and supporting the crossover).
If both conditions are met at the close of a 5-minute candle, a "Buy" signal is generated.
Short Entry Signal:
The 10-period SMA crosses below the 30-period SMA (indicating a potential bearish shift).
AND the current 5-minute candle's closing price is below the 5-period EMA (confirming immediate bearish momentum).
If both conditions are met at the close of a 5-minute candle, a "Sell" signal is generated.
Trade Execution:
When a signal is triggered, the strategy enters a trade (long or short) at the closing price of that 5-minute candle.
Immediately upon entry, it places two contingent orders:
Take Profit (Target): Set at 2% (by default) away from your entry price. For a long trade, it's 2% above; for a short trade, 2% below.
Stop Loss: Set at 1% (by default) away from your entry price. For a long trade, it's 1% below; for a short trade, 1% above.
The trade will remain open until either the Take Profit or Stop Loss price is hit by subsequent 5-minute candles.
Implications for Trading on a 5-Minute Chart:
Increased Trade Frequency: You will likely see many more signals and trades compared to higher timeframes (like 1-hour or daily charts). This means more potential opportunities but also more transaction costs (commissions, slippage).
Sensitivity to Noise: Lower timeframes are more prone to "market noise" – small, random price fluctuations that don't indicate a true trend. While the 5 EMA filter helps, some false signals might still occur.
Faster Price Action: Price movements can be very rapid on a 5-minute chart. Your take profit or stop loss levels might be hit very quickly, sometimes within the same or next few candles.
Parameter Optimization is Crucial: The default MA lengths (10, 30) and EMA (5) might not be optimal for every asset or market condition on a 5-minute chart. You'll need to backtest extensively and potentially adjust these lengths, as well as the targetPerc and stopPerc, to find what works best for the specific instrument you're trading.
Risk Management: The fixed percentage stop loss is vital on a 5-minute chart due to its volatility. Without it, a few unfavorable moves could lead to significant losses.
Position Size Calculator with Fees# Position Size Calculator with Portfolio Management - Manual
## Overview
The Position Size Calculator with Portfolio Management is an advanced Pine Script indicator designed to help traders calculate optimal position sizes based on their total portfolio value and risk management strategy. This tool automatically calculates your risk amount based on portfolio allocation percentages and determines the exact position size needed while accounting for trading fees.
## Key Features
- **Portfolio-Based Risk Management**: Calculates risk based on total portfolio value
- **Tiered Risk Allocation**: Separates trading allocation from total portfolio
- **Automatic Trade Direction Detection**: Determines long/short based on entry vs stop loss
- **Fee Integration**: Accounts for trading fees in position size calculations
- **Risk Factor Adjustment**: Allows scaling of position size up or down
- **Visual Display**: Shows all calculations in a clear, color-coded table
- **Automatic Risk Calculation**: No need to manually input risk amount
## Input Parameters
### Total Portfolio ($)
- **Purpose**: The total value of your investment portfolio
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
- **Example**: If your total portfolio is worth $100,000, enter 100000
### Trading Portfolio Allocation (%)
- **Purpose**: The percentage of your total portfolio allocated to active trading
- **Default**: 20.0%
- **Range**: 0.0% to 100.0%
- **Step**: 0.01
- **Example**: If you allocate 20% of your portfolio to trading, enter 20
### Risk from Trading (%)
- **Purpose**: The percentage of your trading allocation you're willing to risk per trade
- **Default**: 0.1%
- **Range**: Any positive value
- **Step**: 0.01
- **Example**: If you risk 0.1% of your trading allocation per trade, enter 0.1
### Entry Price ($)
- **Purpose**: The price at which you plan to enter the trade
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
### Stop Loss ($)
- **Purpose**: The price at which you will exit if the trade goes against you
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
### Risk Factor
- **Purpose**: A multiplier to scale your position size up or down
- **Default**: 1.0 (no scaling)
- **Range**: 0.0 to 10.0
- **Step**: 0.1
- **Examples**:
- 1.0 = Normal position size
- 2.0 = Double the position size
- 0.5 = Half the position size
### Fee (%)
- **Purpose**: The percentage fee charged per transaction
- **Default**: 0.01% (0.01)
- **Range**: 0.0% to 1.0%
- **Step**: 0.001
## How Risk Amount is Calculated
The script automatically calculates your risk amount using this formula:
```
Risk Amount = Total Portfolio × Trading Allocation (%) × Risk % ÷ 10,000
```
### Example Calculation:
- Total Portfolio: $100,000
- Trading Allocation: 20%
- Risk per Trade: 0.1%
**Risk Amount = $100,000 × 20 × 0.1 ÷ 10,000 = $20**
This means you would risk $20 per trade, which is 0.1% of your $20,000 trading allocation.
## Portfolio Structure Example
Let's say you have a $100,000 portfolio:
### Allocation Structure:
- **Total Portfolio**: $100,000
- **Trading Allocation (20%)**: $20,000
- **Long-term Investments (80%)**: $80,000
### Risk Management:
- **Risk per Trade (0.1% of trading)**: $20
- **Maximum trades at risk**: Could theoretically have 1,000 trades before risking entire trading allocation
## How Position Size is Calculated
### Trade Direction Detection
- **Long Trade**: Entry price > Stop loss price
- **Short Trade**: Entry price < Stop loss price
### Position Size Formulas
#### For Long Trades:
```
Position Size = -Risk Factor × Risk Amount / (Stop Loss × (1 - Fee) - Entry Price × (1 + Fee))
```
#### For Short Trades:
```
Position Size = -Risk Factor × Risk Amount / (Entry Price × (1 - Fee) - Stop Loss × (1 + Fee))
```
## Output Display
The indicator displays a comprehensive table with color-coded sections:
### Portfolio Information (Light Blue Background)
- **Portfolio (USD)**: Your total portfolio value
- **Trading Portfolio Allocation (%)**: Percentage allocated to trading
- **Risk as % of Trading**: Risk percentage per trade
### Trade Setup (Gray Background)
- **Entry Price**: Your specified entry price
- **Stop Loss**: Your specified stop loss price
- **Fee (%)**: Trading fee percentage
- **Risk Factor**: Position size multiplier
### Risk Analysis (Red Background)
- **Risk Amount**: Automatically calculated dollar risk
- **Effective Entry**: Actual entry cost including fees
- **Effective Exit**: Actual exit value including fees
- **Expected Loss**: Calculated loss if stop loss is hit
- **Deviation from Risk %**: Accuracy of risk calculation
### Final Result (Blue Background)
- **Position Size**: Number of shares/units to trade
## Usage Examples
### Example 1: Conservative Long Trade
- **Total Portfolio**: $50,000
- **Trading Allocation**: 15%
- **Risk per Trade**: 0.05%
- **Entry Price**: $25.00
- **Stop Loss**: $24.00
- **Risk Factor**: 1.0
- **Fee**: 0.01%
**Calculated Risk Amount**: $50,000 × 15% × 0.05% ÷ 100 = $3.75
### Example 2: Aggressive Short Trade
- **Total Portfolio**: $200,000
- **Trading Allocation**: 30%
- **Risk per Trade**: 0.2%
- **Entry Price**: $150.00
- **Stop Loss**: $155.00
- **Risk Factor**: 2.0
- **Fee**: 0.01%
**Calculated Risk Amount**: $200,000 × 30% × 0.2% ÷ 100 = $120
**Actual Risk**: $120 × 2.0 = $240 (due to risk factor)
## Color Coding System
- **Green/Red Header**: Trade direction (Long/Short)
- **Light Blue**: Portfolio management parameters
- **Gray**: Trade setup parameters
- **Red**: Risk-related calculations and results
- **Blue**: Final position size result
## Best Practices
### Portfolio Management
1. **Keep trading allocation reasonable** (typically 10-30% of total portfolio)
2. **Use conservative risk percentages** (0.05-0.2% per trade)
3. **Don't risk more than you can afford to lose**
### Risk Management
1. **Start with small risk factors** (1.0 or less) until comfortable
2. **Monitor your total exposure** across all open positions
3. **Adjust risk based on market conditions**
### Trade Execution
1. **Always validate calculations** before placing trades
2. **Account for slippage** in volatile markets
3. **Consider position size relative to liquidity**
## Risk Management Guidelines
### Conservative Approach
- Trading Allocation: 10-20%
- Risk per Trade: 0.05-0.1%
- Risk Factor: 0.5-1.0
### Moderate Approach
- Trading Allocation: 20-30%
- Risk per Trade: 0.1-0.15%
- Risk Factor: 1.0-1.5
### Aggressive Approach
- Trading Allocation: 30-40%
- Risk per Trade: 0.15-0.25%
- Risk Factor: 1.5-2.0
## Troubleshooting
### Common Issues
1. **Position Size shows 0**
- Verify all portfolio inputs are greater than 0
- Check that entry price differs from stop loss
- Ensure calculated risk amount is positive
2. **Very small position sizes**
- Increase risk percentage or risk factor
- Check if your risk amount is too small for the price difference
3. **Large risk deviation**
- Normal for very small positions
- Consider adjusting entry/stop loss levels
### Validation Checklist
- Total portfolio value is realistic
- Trading allocation percentage makes sense
- Risk percentage is conservative
- Entry and stop loss prices are valid
- Trade direction matches your intention
## Advanced Features
### Risk Factor Usage
- **Scaling up**: Use risk factors > 1.0 for high-confidence trades
- **Scaling down**: Use risk factors < 1.0 for uncertain trades
- **Never exceed**: Risk factors that would risk more than your comfort level
### Multiple Timeframe Analysis
- Use different risk factors for different timeframes
- Consider correlation between positions
- Adjust trading allocation based on market conditions
## Disclaimer
This tool is for educational and planning purposes only. Always verify calculations manually and consider market conditions, liquidity, and correlation between positions. The automated risk calculation assumes you're comfortable with the mathematical relationship between portfolio allocation and individual trade risk. Past performance doesn't guarantee future results, and all trading involves risk of loss.
SMA Crossover Strategy with TP/SL📊 Strategy Description: SMA Crossover Strategy with TP/SL
This is a Simple Moving Average (SMA) Crossover Strategy designed to help traders identify trend reversals and manage trades with proper risk-reward logic.
🔹 Entry Logic:
Buy Signal: When the Fast SMA crosses above the Slow SMA → indicating a bullish trend.
Sell Signal: When the Fast SMA crosses below the Slow SMA → indicating a bearish trend.
🔹 Exit Logic:
Take Profit: The strategy exits the position when price reaches a user-defined profit target.
Stop Loss: The trade is closed if price moves against the position beyond the specified stop-loss limit.
⚙️ Parameters:
Fast SMA Length: Number of candles used for fast moving average (default: 10)
Slow SMA Length: Number of candles used for slow moving average (default: 30)
Take Profit (%): Profit target in percentage (default: 0.10%)
Stop Loss (%): Maximum allowed loss per trade (default: 0.10%)
✅ Additional Features:
Strategy backtesting supported
Visual arrows for Buy/Sell signals
Bar coloring based on trend
Alert conditions for Buy/Sell crossover signals
🧠 Suggested Use:
Works best on 1 min, 5 hour, or daily timeframes.
Can be applied to stocks, crypto, forex, or indices.
Ideal for trend-following traders who want automation with risk control.