Ultra Moving Average Rating Trend StrategyThis is a technical analysis strategy based initially on the rating strategy, but fully adapted and converted to moving average rating.
In this case we are using: Ichimoku, SMA, EMA, ALMA, SMMA, LSMA, VWMA, DEMA, HMA, KAMA FRAMA, VIDYA, JMA, TEMA, ZLEMA, TRIMA and T3 moving averages.
With all of them together I am making an index.
Rules for entry and exit:
If % percentage of all the moving averages is telling to go long , we go long or exit short. And viceversa for short.
If there are any questions, please let me know !
Indicators and strategies
Bollinger Pair TradeNYSE:MA-1.6*NYSE:V
Revision: 1
Author: @ozdemirtrading
Revision 2 Considerations :
- Simplify and clean up plotting
Disclaimer: This strategy is currently working on the 5M chart. Change the length input to accommodate your needs.
For the backtesting of more than 3 months, you may need to upgrade your membership.
Description:
The general idea of the strategy is very straightforward: it takes positions according to the lower and upper Bollinger bands.
But I am mainly using this strategy for pair trading stocks. Do not forget that you will get better results if you trade with cointegrated pairs.
Bollinger band: Moving average & standard deviation are calculated based on 20 bars on the 1H chart (approx 240 bars on a 5m chart). X-day moving averages (20 days as default) are also used in the background in some of the exit strategy choices.
You can define position entry levels as the multipliers of standard deviation (for exp: mult2 as 2 * standard deviation).
There are 4 choices for the exit strategy:
SMA: Exit when touches simple moving average (SMA)
SKP: Skip SMA and do not stop if moving towards 20D SMA, and exit if it touches the other side of the band
SKPXDSMA: Skip SMA if moving towards 20D SMA, and exit if it touches 20D SMA
NoExit: Exit if it touches the upper & lower band only.
Options:
- Strategy hard stop: if trade loss reaches a point defined as a percent of the initial capital. Stop taking new positions. (not recommended for pair trade)
- Loss per trade: close position if the loss is at a defined level but keeps watching for new positions.
- Enable expected profit for trade (expected profit is calculated as the distance to SMA) (recommended for pair trade)
- Enable VIX threshold for the following options: (recommended for volatile periods)
- Stop trading if VIX for the previous day closes above the threshold
- Reverse active trade direction if VIX for the previous day is above the threshold
- Take reverse positions (assuming the Bollinger band is going to expand) for all trades
Backtesting:
Close positions after a defined interval: mark this if you want the close the final trade for backtesting purposes. Unmark it to get live signals.
Use custom interval: Backtest specific time periods.
Other Options:
- Use EMA: use an exponential moving average for the calculations instead of simple moving average
- Not against XDSMA: do not take a position against 20D SMA (if X is selected as 20) (recommended for pairs with a clear trend)
- Not in XDSMA 1 DEV: do not take a position in 20D SMA 1*standart deviation band (recommended if you need to decrease # of trades and increase profit for trade)
- Not in XDSMA 2 DEV: do not take a position in 20D SMA 2*standart deviation band
Session management:
- Not in session: Session start and end times can be defined here. If you do not want to trade in certain time intervals, mark that session.(helps to reduce slippage and get more realistic backtest results)
HHLL Strategy This is simple Highest high and Lowest low strategy.
Buy when break HH+offset
Sell when break LL+offset
Offset = (HH-LL)/2
tw.tha_V1 EMAEMA Fibonacci V1 #tw.tha_V1
//@version=5
strategy(" tw.tha_",overlay=1)
a = input.int(8, "EMA 1", minval=1, maxval=9999999, step=1)
b = input.int(13, "EMA 2", minval=1, maxval=9999999, step=1)
c = input.int(21, "EMA 3", minval=1, maxval=9999999, step=1)
d = input.int(34, "EMA 4", minval=1, maxval=9999999, step=1)
e = input.int(55, "EMA 5", minval=1, maxval=9999999, step=1)
f = input.int(89, "EMA 6", minval=1, maxval=9999999, step=1)
g = input.int(144, "EMA 7", minval=1, maxval=9999999, step=1)
h = input.int(233, "EMA 8", minval=1, maxval=9999999, step=1)
i = input.int(377, "EMA 9", minval=1, maxval=9999999, step=1)
j = input.int(610, "EMA 10", minval=1, maxval=9999999, step=1)
k = input.int(987, "EMA 11", minval=1, maxval=9999999, step=1)
l = input.int(1597, "EMA 12", minval=1, maxval=9999999, step=1)
m = input.int(2584, "EMA 13", minval=1, maxval=9999999, step=1)
n = input.int(4181, "EMA 14", minval=1, maxval=9999999, step=1)
maa=ta.ema(close,a)
mab=ta.ema(close,b)
mac=ta.ema(close,d)
mad=ta.ema(close,d)
mae=ta.ema(close,e)
maf=ta.ema(close,f)
mag=ta.ema(close,g)
mah=ta.ema(close,h)
mai=ta.ema(close,i)
maj=ta.ema(close,j)
mak=ta.ema(close,k)
mal=ta.ema(close,l)
mam=ta.ema(close,m)
man=ta.ema(close,n)
plot(maa,color=color.green)
plot(mab,color=color.green)
plot(mac,color=color.green)
plot(mad,color=color.green)
plot(mae,color=color.green)
plot(maf,color=color.green)
plot(mag,color=color.blue)
plot(mah,color=color.blue)
plot(mai,color=color.blue)
plot(maj,color=color.blue)
plot(mak,color=color.blue)
plot(mal,color=color.yellow)
plot(mam,color=color.yellow)
plot(man,color=color.yellow)
tw.tha_V2 EMAEMA Fibonacci V2 #tw.tha_V2
//@version=5
strategy(" tw.tha_",overlay=1)
lot= input.float(0, "Lot", minval=0, maxval=999, step=0.5)
a = input.int(8, "EMA 1", minval=1, maxval=9999999, step=1)
b = input.int(13, "EMA 2", minval=1, maxval=9999999, step=1)
e = input.int(55, "EMA 5", minval=1, maxval=9999999, step=1)
f = input.int(89, "EMA 6", minval=1, maxval=9999999, step=1)
h = input.int(233, "EMA 8", minval=1, maxval=9999999, step=1)
i = input.int(377, "EMA 9", minval=1, maxval=9999999, step=1)
k = input.int(987, "EMA 11", minval=1, maxval=9999999, step=1)
l = input.int(1597, "EMA 12", minval=1, maxval=9999999, step=1)
maa=ta.ema(close,a)
mab=ta.ema(close,b)
mae=ta.ema(close,e)
maf=ta.ema(close,f)
mah=ta.ema(close,h)
mai=ta.ema(close,i)
mak=ta.ema(close,k)
mal=ta.ema(close,l)
plot(maa,color=color.green)
plot(mab,color=color.blue)
plot(mae,color=color.yellow)
plot(maf,color=color.orange)
plot(mah,color=color.red)
plot(mai,color=color.purple)
plot(mak,color=color.silver)
plot(mal,color=color.white)
eswaran ab//@version=5
strategy("MACD Strategy", overlay=true)
fastLength = input(12)
slowlength = input(26)
MACDLength = input(9)
MACD = ta.ema(close, fastLength) - ta.ema(close, slowlength)
aMACD = ta.ema(MACD, MACDLength)
delta = MACD - aMACD
if (ta.crossover(delta, 0))
strategy.entry("MacdLE", strategy.long, comment="MacdLE")
if (ta.crossunder(delta, 0))
strategy.entry("MacdSE", strategy.short, comment="MacdSE")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
Simple and Profitable Scalping Strategy (ForexSignals TV)Strategy is based on the "SIMPLE and PROFITABLE Forex Scalping Strategy" taken from YouTube channel ForexSignals TV.
See video for a detailed explaination of the whole strategy.
I'm not entirely happy with the performance of this strategy yet however I do believe it has potential as the concept makes a lot of sense.
I'm open to any ideas people have on how it could be improved.
Strategy incorporates the following features:
Risk management:
Configurable X% loss per stop (default to 1%)
Configurable R:R ratio
Trade entry:
Based on stratgey conditions outlined below
Trade exit:
Based on stratgey conditions outlined below
Backtesting:
Configurable backtesting range by date
Trade drawings:
Each entry condition indicator can be turned on and off
TP/SL boxes drawn for all trades. Can be turned on and off
Trade exit information labels. Can be turned on and off
NOTE: Trade drawings will only be applicable when using overlay strategies
Debugging:
Includes section with useful debugging techniques
Strategy conditions
Trade entry:
LONG
C1: On higher timeframe trend EMAs, Fast EMA must be above Slow EMA
C2: On higher timeframe trend EMAs, price must be above Fast EMA
C3: On current timeframe entry EMAs, Fast EMA must be above Medium EMA and Medium EMA must be above Slow EMA
C4: On current timeframe entry EMAs, all 3 EMA lines must have fanned out in upward direction for previous X candles (configurable)
C5: On current timeframe entry EMAs, previous candle must have closed above and not touched any EMA lines
C6: On current timeframe entry EMAs, current candle must have pulled back to touch the EMA line(s)
C7: Price must break through the high of the last X candles (plus price buffer) to trigger entry (stop order entry)
SHORT
C1: On higher timeframe trend EMAs, Fast EMA must be below Slow EMA
C2: On higher timeframe trend EMAs, price must be below Fast EMA
C3: On current timeframe entry EMAs, Fast EMA must be below Medium EMA and Medium EMA must be below Slow EMA
C4: On current timeframe entry EMAs, all 3 EMA lines must have fanned out in downward direction for previous X candles (configurable)
C5: On current timeframe entry EMAs, previous candle must have closed above and not touched any EMA lines
C6: On current timeframe entry EMAs, current candle must have pulled back to touch the EMA line(s)
C7: Price must break through the low of the last X candles (plus price buffer) to trigger entry (stop order entry)
Trade entry:
Calculated position size based on risk tolerance
Entry price is a stop order set just above (buffer configurable) the recent swing high/low (long/short)
Trade exit:
Stop Loss is set just below (buffer configurable) trigger candle's low/high (long/short)
Take Profit calculated from Stop Loss using R:R ratio
Credits
"SIMPLE and PROFITABLE Forex Scalping Strategy" taken from YouTube channel ForexSignals TV
Impulse Strategy Signals V2This is a low timeframe strategy based on SMMAs and RSI, shared by Investishare.
This script turns the indicator into a strategy and allows for several variables to be customized.
RSI with Slow and Fast MA Crossing Strategy (by Coinrule)This strategy utilises 3 different conditions that have to be met to buy and 1 condition to sell. This strategy works best on the ETH/USDT pair on the 4-hour timescale.
In order for the strategy to enter the trade, it must meet all of the conditions listed below:
ENTRY
RSI increases by 5
RSI is lower than 70
MA9 crosses above MA50
To exit a trade, the below condition must be met:
EXIT
MA50 crosses above MA9
This strategy works well on LINK/USDT on the 1-day timeframe, MIOTA/USDT on the 2-hour timeframe, BTC/USDT on the 4-hour timeframe, and BEST/USDT on the 1-day timeframe (and 4h).
Back-tested from 1 January 2020.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
SUPPORT RESISTANCE STRATEGY [5MIN TF]A SUPPORT RESISTANCE BREAKOUT STRATEGY for 5 minute Time-Frame , that has the time condition for Indian Markets
The Timing can be changed to fit other markets, scroll down to "TIME CONDITION" to know more.
The commission is also included in the strategy .
The basic idea is when ,
1) Price crosses above Resistance Level ,indicated by Red Line, is a Long condition.
2) Price crosses below Support Level ,indicated by Green Line , is a Short condition.
3) Candle high crosses above ema1, is a part of the Long condition .
4) Candle low crosses below ema1, is a part of the Short condition .
5) Volume Threshold is an added confirmation for long/short positions.
6) Maximum Risk per trade for the intraday trade can be changed .
7) Default qty size is set to 50 contracts , which can be changed under settings → properties → order size.
8) ATR is used for trailing after entry, as mentioned in the inputs below.
// ═════════════════════════//
// ————————> INPUTS <————————— //
// ═════════════════════════//
→ L_Bars ———————————> Length of Resistance / Support Levels.
→ R_Bars ———————————> Length of Resistance / Support Levels.
→ Volume Break ———————> Volume Breakout from range to confirm Long/Short position.
→ Price Cross Ema —————> Added condition as explained above (3) and (4).
→ ATR LONG —————————> ATR stoploss trail for Long positions.
→ ATR SHORT ————————> ATR stoploss trail for Short positions.
→ RISK ————————————> Maximum Risk per trade intraday.
The strategy was back-tested on TCS ,the input values and the results are mentioned under "BACKTEST RESULTS" below.
// ═════════════════════════ //
// ————————> PROPERTIES<——————— //
// ═════════════════════════ //
Default_qty_size ————> 50 contracts , which can be changed under
Settings
↓
Properties
↓
Order size
// ═══════════════════════════════//
// ————————> TIME CONDITION <————————— //
// ═══════════════════════════════//
The time can be changed in the script , Add it → click on ' { } ' → Pine editor→ making it a copy [right top corner} → Edit the line 27.
The Indian Markets open at 9:15am and closes at 3:30pm.
The 'time_cond' specifies the time at which Entries should happen .
"Close All" function closes all the trades at 3pm , at the open of the next candle.
To change the time to close all trades , Go to Pine Editor → Edit the line 92 .
All open trades get closed at 3pm , because some brokers don't allow you to place fresh intraday orders after 3pm .
// ═══════════════════════════════════════════════ //
// ————————> BACKTEST RESULTS ( 100 CLOSED TRADES )<————————— //
// ═══════════════════════════════════════════════ //
INPUTS can be changed for better Back-Test results.
The strategy applied to NSE:TCS ( 5 min Time-Frame and contract size 50) gives us 60% profitability , as shown below
It was tested for a period a 6 months with a Profit Factor of 1.8 ,net Profit of 30,000 Rs profit .
Sharpe Ratio : 0.49
Sortino Ratio : 1.4
The graph has a Linear Curve with Consistent Profits.
The INPUTS are as follows,
1) L_Bars —————————> 4
2) R_Bars —————————> 4
3) Volume Break ————> 5
4) Price Cross Ema ——> 100
5) ATR LONG ——————> 2.4
6) ATR SHORT —————> 2.6
7) RISK —————————> 2000
8) Default qty size ——> 50
NSE:TCS
Save it to favorites.
Apply it to your charts Now !!
Thank You ☺ NSE:TCS
PIVOT STRATEGY [INDIAN MARKET TIMING]
A Back-tested Profitable Strategy for Free!!
A PIVOT INTRADAY STRATEGY for 5 minute Time-Frame , that also explains the time condition for Indian Markets
The Timing can be changed to fit other markets, scroll down to "TIME CONDITION" to know more.
The commission is also included in the strategy .
The basic idea is when ,
1) Price crosses above ema1 ,indicated by pivot highest line in green color .
2) Price crosses below ema1 ,indicated by pivot lowest line in red color .
3) Candle high crosses above pivot highest , is the Long condition .
4) Candle low crosses below pivot lowest , is the Short condition .
5) Maximum Risk per trade for the intraday trade can be changed .
6) Default_qty_size is set to 60 contracts , which can be changed under settings → properties → order size .
7) ATR is used for trailing after entry, as mentioned in the inputs below.
// ═════════════════════════//
// ————————> INPUTS <————————— //
// ═════════════════════════//
Leftbars —————> Length of pivot highs and lows
Rightbars —————> Length of pivot highs and lows
Price Cross Ema —————> Added condition
ATR LONG —————> ATR stoploss trail for Long positions
ATR SHORT —————> ATR stoploss trail for Short positions
RISK —————> Maximum Risk per trade for the day
The strategy was back-tested on RELIANCE ,the input values and the results are mentioned under "BACKTEST RESULTS" below .
// ═════════════════════════ //
// ————————> PROPERTIES<——————— //
// ═════════════════════════ //
Default_qty_size ————> 60 contracts , which can be changed under settings
↓
properties
↓
order size
// ═══════════════════════════════//
// ————————> TIME CONDITION <————————— //
// ═══════════════════════════════//
The time can be changed in the script , Add it → click on ' { } ' → Pine editor→ making it a copy [right top corner} → Edit the line 25 .
The Indian Markets open at 9:15am and closes at 3:30pm .
The 'time_cond' specifies the time at which Entries should happen .
"Close All" function closes all the trades at 3pm, at the open of the next candle.
To change the time to close all trades , Go to Pine Editor → Edit the line 103 .
All open trades get closed at 3pm , because some brokers don't allow you to place fresh intraday orders after 3pm .
NSE:RELIANCE
// ═══════════════════════════════════════════════ //
// ————————> BACKTEST RESULTS ( 128 CLOSED TRADES )<————————— //
// ═══════════════════════════════════════════════ //
INPUTS can be changed for better back-test results.
The strategy applied to NIFTY ( 5 min Time-Frame and contract size 60 ) gives us 60% profitability y , as shown below
It was tested for a period a 6 months with a Profit Factor of 1.45 ,net Profit of 21,500Rs profit .
Sharpe Ratio : 0.311
Sortino Ratio : 0.727
The graph has a Linear Curve with consistent profits .
The INPUTS are as follows,
1) Leftbars ————————> 3
2) Rightbars ————————> 5
3) Price Cross Ema ——————> 150
4) ATR LONG ————————> 2.7
5) ATR SHORT ———————> 2.9
6) RISK —————————> 2500
7) Default qty size ——————> 60
NSE:RELIANCE
Save it to favorites.
Apply it to your charts Now !!
↓
FOLLOW US FOR MORE !
Thank me later ;)
DCA After Downtrend v2 (by BHD_Trade_Bot)The purpose of the strategy is to identify the end of a short-term downtrend . So that you can easily to DCA certain amount of money for each month.
ENTRY
The buy orders are placed on a monthly basis for assets at the end of a short-term downtrend:
- Each month condition: In 1-hour time frame, each month has 24 * 30 candles
- The end of short-term downtrend condition: use MACD for less delay
CLOSE
The sell orders are placed when:
- Is last bar
The strategy use $1000 and trading fee is 1.1% for each order.
Pro tip: The 1-hour time frame has the best results on average:
- Total spent: $1000 x 33 = $33,000
- Total profit: $65,578
Stock Gaps SPY Correlation StrategyThis is daytrade stock strategy, designed to take the best out of the daily gaps that are forming between the close of previous day and opening of present day.
At the same time its logic has been adapted for SPY chart, in order to use correlation with the other stocks/assets/ etf which are linked with SP500 movement.
Lastly it has been added 2 new confirmation logics, based on the USI: advance/decline chart and percentage above vwap among all US stocks.
The rules for entry are simple :
We are at the opening daily candle, we have a long/short gap based on where the opening is happening and at the same time we are checking to see that the current different between the current difference between low and previous high (or viceversa) is higher than an established parameter(minimal deviation )
For exit, we exit based on time/clock parameter, in this case by default I selected 1h and half before close of the US session.
For testing purposes I have used 10% of the available capital, with a 0.0035$ comission per each share bought ( IBKR comissions)
If there are any questions, please let me know either here or in private !
SSL + Wave Trend StrategyStrategy incorporates the following features:
Risk management:
Configurable X% loss per stop loss
Configurable R:R ratio
Trade entry:
Based on strategy conditions below
Trade exit:
Based on strategy conditions below
Backtesting:
Configurable backtesting range by date
Trade drawings:
Each entry condition indicator can be turned on and off
TP/SL boxes drawn for all trades. Can be turned on and off
Trade exit information labels. Can be turned on and off
NOTE: Trade drawings will only be applicable when using overlay strategies
Alerting:
Alerts on LONG and SHORT trade entries
Debugging:
Includes section with useful debugging techniques
Strategy conditions
Trade entry:
LONG
C1: SSL Hybrid baseline is BLUE
C2: SSL Channel crosses up (green above red)
C3: Wave Trend crosses up (represented by pink candle body)
C4: Entry candle height is not greater than configured threshold
C5: Entry candle is inside Keltner Channel (wicks or body depending on configuration)
C6: Take Profit target does not touch EMA (represents resistance)
SHORT
C1: SSL Hybrid baseline is RED
C2: SSL Channel crosses down (red above green)
C3: Wave Trend crosses down (represented by orange candle body)
C4: Entry candle height is not greater than configured threshold
C5: Entry candle is inside Keltner Channel (wicks or body depending on configuration)
C6: Take Profit target does not touch EMA (represents support)
Trade exit:
Stop Loss: Size configurable with NNFX ATR multiplier
Take Profit: Calculated from Stop Loss using R:R ratio
Credits
Strategy is based on the YouTube video "This Unique Strategy Made 47% Profit in 2.5 Months " by TradeSmart.
It combines the following indicators to determine trade entry/exit conditions:
Wave Trend: Indicator: WaveTrend Oscillator by @LazyBear
SSL Channel: SSL channel by @ErwinBeckers
SSL Hybrid: SSL Hybrid by @Mihkel00
Keltner Channels: Keltner Channels Bands by @ceyhun
Candle Height: Candle Height in Percentage - Columns by @FreeReveller
NNFX ATR: NNFX ATR by @sueun123
Pro Trading Art Open Range Breakout StrategyThis strategy is based on Selected Candle High Low Breakout with buffer point.
You can select specific candle from input tab by giving time of that candle.
Default Settings:
Start Hour : Hour of starting candle means from this input you can specify opening candle. Default is 9.
Start Minute: Minute of starting candle. Default is 15. Means Default opening candle is 9:15
Stop Hour : Means After this time no new trade will execute.
End Hour & End Minute & Close All Trade : Means when you specify End Hour and Minute and Close all trade is true then strategy will close all trade on specified time.
Buffer : With the help of this option you can add some point in High and low of Opening Candle
Trade Mode : You can specify Target and Stop Loss in point or Percent
Stop Loss Point or Percent : This will work according to Trade Mode
Target Point Or Percent : This will work according to Trade Mode
Risk Management Strategy TemplateThis strategy is intended to be used as a base template for building new strategies.
It incorporates the following features:
Risk management:
Configurable X% loss per stop loss
Configurable R:R ratio
Trade entry:
Calculated position size based on risk tolerance
Trade exit:
Stop Loss currently configurable ATR multiplier but can be replaced based on strategy
Take Profit calculated from Stop Loss using R:R ratio
Backtesting:
Configurable backtesting range by date
Trade drawings:
TP/SL boxes drawn for all trades. Can be turned on and off
Trade exit information labels. Can be turned on and off
NOTE: Trade drawings will only be applicable when using overlay strategies
Debugging:
Includes section with useful debugging techniques
Strategy conditions
Trade entry:
LONG
C1: Price is above EMA line
C2: RSI is crossing out of oversold area
SHORT
C1: Price is below EMA line
C2: RSI is crossing out of overbought area
Trade exit:
Stop Loss: Stop Loss ATR multiplier is hit
Take Profit: R:R multiplier * Stop Loss is hit
The idea is to use RSI to catch pullbacks within the main trend.
Note that this strategy is intended to be a simple base strategy for building upon. It was not designed to be traded in its current form.
Under09_01Parametros de entradas
Activo->btc xbtusd (Bitmex)
Temporalidad->2h
SL-> 0.2
TP->12.2
Angulo->4.2
p->2
longitud->27
//@version=4
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
//Ultima version underground09
strategy(title = " underground09",
shorttitle = "Under09",
overlay = true,
precision = 8,
calc_on_order_fills = true,
calc_on_every_tick = true,
backtest_fill_limits_assumption = 0,
default_qty_type = strategy.fixed,
default_qty_value = 2,
initial_capital = 10000,
pyramiding=5,
currency = currency.USD,
linktoseries = true)
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
var sl = 0.0
var tp = 0.0
var acumaldor_vxp = 0.0
var acomuldor_vol = 0.0
//stop_loss = input(defval=0.2, title="Porcentaje Stop Loss", type=input.float, step=0.2)
stop_loss = input(defval=1.4, title="Porcentaje Stop Loss", type=input.float, step=0.2)
//take_profit = input(defval=4.4, title="Porcentaje Take Profit", type=input.float, step=0.2)
take_profit = input(defval=5.6, title="Porcentaje Take Profit", type=input.float, step=0.2)
//pintar_trade = input(defval=false, title="Pintar trade TP SL")
angulo_permitido = input(defval=26.8, title="Angulo permitido", type=input.float, step=0.2)
backTestSectionFrom = input(title = "═══════════════ From ═══════════════", defval = true, type = input.bool)
FromMonth = input(defval = 1, title = "Month", minval = 1)
FromDay = input(defval = 1, title = "Day", minval = 1)
FromYear = input(defval = 2019, title = "Year", minval = 2014)
backTestSectionTo = input(title = "════════════════ To ════════════════", defval = true, type = input.bool)
ToMonth = input(defval = 31, title = "Month", minval = 1)
ToDay = input(defval = 12, title = "Day", minval = 1)
ToYear = input(defval = 9999, title = "Year", minval = 2014)
Config = input(title = "══════════════ Config ══════════════", defval = true, type = input.bool)
//p = input(6)
p = input(4)
//length = input(30)
length = input(26)
//
backTestPeriod() => (time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))
//
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
x1 = bar_index
x2 = sqrt(x1)
y = high
//
S11 = sum(x2,length) - sqrt(sum(x1,length)) / length
S12 = sum(x1*x2,length) - (sum(x1,length) * sum(x2,length)) / length
S22 = sum(sqrt(x2),length) - sqrt(sum(x2,length)) / length
Sy1 = sum (y*x1,length) - (sum(y,length) * sum(x1,length)) / length
Sy2 = sum (y*x2,length) - (sum(y,length) * sum(x2,length)) / length
//
max1 = sma(x1,length)
max2 = sma(x2,length)
may = sma(y,length)
b2 = ((Sy1 * S22) - (Sy2*S12))/(S22*S11 - sqrt(S12))
b3 = ((Sy2 * S11) - (Sy1 * S12))/(S22 * S11 - sqrt(S12))
b1 = may - b2*max1 - b3*max2
qr = b1 + b2*x1 + b3*x2
//
yl = low
//
Sy1l = sum(yl*x1,length) - (sum(yl,length) * sum(x1,length)) / length
Sy2l = sum(yl*x2,length) - (sum(yl,length) * sum(x2,length)) / length
//
mayl = sma(yl,length)
b2l = ((Sy1l * S22) - (Sy2l*S12))/(S22*S11 - sqrt(S12))
b3l = ((Sy2l * S11) - (Sy1l * S12))/(S22 * S11 - sqrt(S12))
b1l = mayl - b2l*max1 - b3l*max2
qrl = b1l + b2l*x1 + b3l*x2
//
period = round(p/2)+1
hh = qr
ll = qrl
countH = 0
countL = 0
buy=0
sell=0
//
for i = 1 to period-1
if qr ll
countL:=countL+1
for i = period+1 to p+1
if qr ll
countL:=countL+1
if countH==p
pivotH = high
buy := 1
if countL==p
pivotL = low
sell := 1
//
Angulo(_serie) =>
atan( _serie - _serie ) * 180 / acos(-1)
//calcular elvwap
vxp = volume*hlc3
//:= signo de acumulador
acumaldor_vxp := acumaldor_vxp + vxp
acomuldor_vol := acomuldor_vol + volume
vwap2 = acumaldor_vxp / acomuldor_vol
pendiente = Angulo(vwap2)
//
plotshape(buy == 1 , text='⬆️', style=shape.arrowup, location=location.belowbar, color=#32CD32, textcolor=color.white, offset=0, transp=0,size=size.auto)
if buy == 1
alert("Posible long",alert.freq_all )
plotshape(sell == 1 , text='⬇️', style=shape.arrowdown, location=location.abovebar, color=#FF0000, textcolor=color.white, offset=0, transp=0,size=size.auto)
if sell == 1
alert("Posible short",alert.freq_all )
//
//if (backTestPeriod())
//strategy.entry("long", true, 1, when = buy == 1)
// strategy.entry("short", false, 1, when = sell == 1)
if buy == 1 and pendiente > angulo_permitido
//if buy == 1
cantidad = round(strategy.equity / close )
strategy.entry("long", true, cantidad, comment = "Compra")
sl := close * ( 1 - (stop_loss/100))
tp := close * ( 1 + (take_profit/100))
if sell == 1 and pendiente > angulo_permitido
//if sell == 1
cantidad = round(strategy.equity / close )
strategy.entry("short", false, cantidad, comment = "Venta")
sl := close * ( 1 + (stop_loss/100))
tp := close * ( 1 - (take_profit/100))
//Validaciones
comprado = strategy.position_size > 0 //true si es positivo
vendido = strategy.position_size < 0 //true si es negativo
if comprado
//Salir sl
if close >= tp
//plotshape(close >= tp, style=shape.xcross)
strategy.close("long", comment="TP")
//Salir tp
if close <= sl
strategy.close("long", comment="SL")
if vendido
//Salir sl
if close <= tp
strategy.close("short", comment="TP")
//Salir tp
if close >= sl
strategy.close("short", comment="SL")
//sl tp
plot( sl , color =color.red, style=plot.style_cross)
plot( tp , color= color.green , style=plot.style_circles)
//color
//bgcolor (comprado ? color.green: na)
//bgcolor (vendido ? color.red: na)
//if pintar_trade
//bgcolor (close >= tp ? color.green : na, transp=80)
//bgcolor (close >= sl ? color.red : na, transp=80)
Accumulation Stage Identifier and Strategy around for TradingIn the psychology of trading at any market condition, there are four stage usually occurs on any tickers.
Stage 1 -> Neglect phase or consolidation phase
It occurs when the company does not produce the expected result and waiting for next result.
It can extend for days, weeks, months and years. Never give entry at this stage though that blue-chip told to be cheaper in price.
Stage 2 -> Accumulation
It occurs when the company's earning and sales consistently grows.
It can extend for days, weeks, months but should not expect the continues increase in price, as there will be potential pull-back which can be considered as opportunity to accumulate.
If the company fundamental is good, just give some space at the time of pullback.
Most of the time, the pullback volume will be low to compare to volume at the time of increase.
Usually, the stock that is going through accumulation stage will definitely trade above 200SMA and short term MA will be greater than long term moving average.
Continues the highest high and highest low along with volume.
Stage 3 -> Distribution
It occurs when the company's earning and sales stagnated due to certain reason.
It can extend for days, weeks while the price and volume highly volatile.
High volume while the price low
Typically, the stock that is going through distribution stage will certainly trade below 200SMA and short term MA will be lesser than long term moving average.
Continues the lowest high and lowest low along with volume.
Stage 4 -> Capitalization
Price reaches the 52W low while volume spikes on big down.
In each stage, the price & volume are perfect indicator to highlight the situation and the trader with proper discipline and patients can certainly reap the fruitful outcome of accumulation stage.
Based on this explanation, here is the strategy that is created with 50,90 & 200 Simple moving average and price volume trends (PVT) indicator applied on MACD to signal whenever the PVT convergence and divergence.
Note:
As the indicator designed to signal on the ticker that trade above 200 moving average, it is good to use this strategy on companies that are fundamental strong.
Whenever, there is pull back happens, the strategy might signal for exit, however, here comes the traders patient based on the conviction on the particular chosen stocks.
White being patient is good, disciplinary in following the strategy also important. Hence, consider the action when the stock goes opposite direction from your expectation.
Hope this strategy would help you find the profit.
Happy investing.
Simple Moving Averge StrategySimple Vs. Exponential Moving Averages
Formula for Exponential Moving Average (EMA)
\begin{aligned} &\begin{aligned} EMA_{\text{Today}}=&\left(\text{Value}_{\text{Today}}\ast\left(\frac{\text{Smoothing}}{1+\text{Days}}\right)\right)\\ &+EMA_{\text{Yesterday}}\ast\left(1-\left(\frac{\text{Smoothing}}{1+\text{Days}}\right)\right)\end{aligned}\\ &\textbf{where:}\\ &EMA=\text{Exponential moving average} \end{aligned}
EMA
Today
=
(Value
Today
∗(
1+Days
Smoothing
))
+EMA
Yesterday
∗(1−(
1+Days
Smoothing
))
where:
EMA=Exponential moving average
While there are many possible choices for the smoothing factor, the most common choice is:
oussamacryptoWhat Is an Exponential Moving Average (EMA)?
An exponential moving average (EMA) is a type of moving average (MA) that places a greater weight and significance on the most recent data points. The exponential moving average is also referred to as the exponentially weighted moving average. An exponentially weighted moving average reacts more significantly to recent price changes than a simple moving average simple moving average (SMA), which applies an equal weight to all observations in the period.