Initial Commit ...
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
# Range Filter Scalping (XST_RF15M)
|
||||
|
||||
## Setup
|
||||
|
||||
- **TF**: 15m
|
||||
- **Asset**: TSLA
|
||||
- **R2R**: 1:1.5
|
||||
- **Indicators**:
|
||||
- Range Filter Buy and Sell 5min (gulkroth):
|
||||
- Hide Bar Colors;
|
||||
- Change Sampling Period to 41
|
||||
- **Oscillators**:
|
||||
- Stockastic Histogram (nboone):
|
||||
- Change Plot 0 to Area;
|
||||
|
||||
## Using the Strategy
|
||||
|
||||
### Long/Buy Conditions
|
||||
|
||||
- RF gives BUY Signal;
|
||||
- Price is Above RF Line;
|
||||
- Stochastic is Green;
|
||||
- Market forms a Bullish Candle;
|
||||
|
||||
#### Long SL
|
||||
|
||||
place sl at below of RF low line;
|
||||
|
||||
#### Long TP
|
||||
|
||||
calculate based on R2R;
|
||||
|
||||
### Short/Sell Conditions
|
||||
|
||||
- RF gives SELL Signal;
|
||||
- Price is below RF Line;
|
||||
- Stochastic is Red;
|
||||
- Market forms a Bearish Candle;
|
||||
|
||||
#### Short SL
|
||||
|
||||
place sl at high of RF Target Range.
|
||||
|
||||
#### Short TP
|
||||
|
||||
calculate based on R2R;
|
||||
|
||||
### Signals Overlap
|
||||
|
||||
how to handle signals overlaps.
|
||||
@@ -0,0 +1,66 @@
|
||||
# XST_SR15M
|
||||
|
||||
## Report
|
||||
|
||||
### Makret
|
||||
|
||||
ETHUSDT
|
||||
|
||||
### Exchange
|
||||
|
||||
Kucoin
|
||||
|
||||
### Time Frame
|
||||
|
||||
15min
|
||||
|
||||
### Start Date
|
||||
|
||||
06 may 2023 | 01:45
|
||||
|
||||
### End Date
|
||||
|
||||
20 may 2023 | 00:30
|
||||
|
||||
### Risk to Reward
|
||||
|
||||
1:1.5
|
||||
|
||||
### Reports
|
||||
|
||||
| ID | Position Type | TP | SL | Description |
|
||||
| :--: | :-----------: | :--: | :--: | :---------- |
|
||||
| 1 | Short | x | | |
|
||||
| 2 | Short | x | | |
|
||||
| 3 | Short | x | | |
|
||||
| 4 | Short | x | | |
|
||||
| 5 | Short | | x | |
|
||||
| 6 | Short | x | | |
|
||||
| 7 | Short | | x | |
|
||||
| 8 | Short | x | | |
|
||||
| 9 | Short | | x | |
|
||||
| 10 | Short | | | Open |
|
||||
| 11 | Short | | x | |
|
||||
| 12 | Short | x | | |
|
||||
| 13 | Long | | x | Close In Profit before Next Signal |
|
||||
| 14 | Long | | x | |
|
||||
| 15 | Long | x | | Close In Profit before Next Signal |
|
||||
| 16 | Long | x | | |
|
||||
| 17 | Long | x | | |
|
||||
| 18 | Long | x | | |
|
||||
| 19 | Long | x | | |
|
||||
| 20 | Long | x | | |
|
||||
|
||||
#### Signals Results
|
||||
|
||||
| Type | Count | TPs | SLs |
|
||||
| :-: | :-: | :-: | :-: |
|
||||
| Shorts | 12 | 07 | 04 | 01 Open
|
||||
| Longs | 08 | 06 | 02 |
|
||||
| Total | 20 | 13 | 06 |
|
||||
|
||||
#### Analysis
|
||||
|
||||
per trade volume: 10$
|
||||
total spending: 200$
|
||||
total comeback: 195$
|
||||
@@ -0,0 +1,287 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center XTrade RF15M Strategy
|
||||
// ---------------------------------------------
|
||||
// in this strategy i must use:
|
||||
// - Price Action Candle Recognition;
|
||||
// -
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
//@version=5
|
||||
indicator(title="SaherElm XTrade RF15M Strategy", shorttitle = "XST_RF15M", overlay = true)
|
||||
|
||||
//
|
||||
// START Inputs ....
|
||||
//
|
||||
//
|
||||
// Determines Show Signals or not ...
|
||||
showSignals = input.bool(defval = true, title = "Show Signals", group = "Strategy")
|
||||
showStopLosses = input.bool(defval = true, title = "Show Stop Losses", group = "Strategy")
|
||||
showRangeFilter = input.bool(defval = false, title = "Show Range Filter", group = "Strategy")
|
||||
|
||||
//
|
||||
// Show Signals based on their types ...
|
||||
showLongSignals = input.bool(defval = true, title = "Show Long Signals", group = "Signals")
|
||||
showShortSignals = input.bool(defval = true, title = "Show Short Signals", group = "Signals")
|
||||
|
||||
//
|
||||
// Show Stop Losses based on their types ...
|
||||
showLongStopLosses = input.bool(defval = true, title = "Show Long Stop Losses", group = "Stop Loss")
|
||||
showShortStopLosses = input.bool(defval = true, title = "Show Short Stop Losses", group = "Stop Loss")
|
||||
//
|
||||
// END Inputs ....
|
||||
//
|
||||
|
||||
//
|
||||
// START Functions ....
|
||||
//
|
||||
//////////////////////////////
|
||||
// START Price Action Candles
|
||||
//////////////////////////////
|
||||
//
|
||||
// Retrieve Specific Candle Height (based on low and high) ...
|
||||
getCandleRange() =>
|
||||
high - low
|
||||
|
||||
//
|
||||
// Retrieve Candle Ranges Thirs Section ...
|
||||
getCandleThird() =>
|
||||
getCandleRange() / 3
|
||||
|
||||
//
|
||||
// Determines a Candle is Bullish or not ...
|
||||
isBullishCandle() =>
|
||||
close > low + (getCandleThird() * 2)
|
||||
|
||||
//
|
||||
// Determines a Candle is Bearish or not ...
|
||||
isNeutralCandle() =>
|
||||
close < low + (getCandleThird() * 2) and close > low + getCandleThird()
|
||||
|
||||
//
|
||||
// Determines a Candle is Neutral or not ...
|
||||
isBearishCandle() =>
|
||||
close < low + getCandleThird()
|
||||
/////////////////////////////
|
||||
// END Price Action Candles
|
||||
/////////////////////////////
|
||||
|
||||
///////////////////////////////
|
||||
// START Range Filter Buy Sell
|
||||
///////////////////////////////
|
||||
//
|
||||
// Smooth Average Range
|
||||
smoothAverageRange(x, t, m) =>
|
||||
wper = t * 2 - 1
|
||||
avrng = ta.ema(math.abs(x - x[1]), t)
|
||||
result = ta.ema(avrng, wper) * m
|
||||
result
|
||||
|
||||
//
|
||||
// Range Filter ...
|
||||
rangeFilter(x, r) =>
|
||||
result = x
|
||||
result := x > nz(result[1]) ? x - r < nz(result[1]) ? nz(result[1]) : x - r : x + r > nz(result[1]) ? nz(result[1]) : x + r
|
||||
result
|
||||
///////////////////////////////
|
||||
// END Range Filter Buy Sell
|
||||
///////////////////////////////
|
||||
//
|
||||
// END Functions ....
|
||||
//
|
||||
|
||||
//
|
||||
// START Calculations ....
|
||||
//
|
||||
//
|
||||
var shortColor = color.red
|
||||
var longColor = color.lime
|
||||
var longStopLossColor = color.fuchsia
|
||||
var shortStopLossColor = color.aqua
|
||||
|
||||
//////////////////////////////
|
||||
// START Price Action Candles
|
||||
//////////////////////////////
|
||||
//
|
||||
var bullishColor = color.lime
|
||||
var bullishShape = shape.arrowup
|
||||
var bullishTitle = "Bullish"
|
||||
var bullishType = 1
|
||||
|
||||
//
|
||||
var bearishColor = color.red
|
||||
var bearishShape = shape.arrowdown
|
||||
var bearishTitle = "Bearish"
|
||||
var bearishType = -1
|
||||
|
||||
//
|
||||
var neutralColor = color.gray
|
||||
var neutralShape = shape.circle
|
||||
var neutralTitle = "Neutral"
|
||||
var neutralType = 0
|
||||
|
||||
//
|
||||
candleType = isBullishCandle() ? bullishType : isNeutralCandle() ? neutralType : isBearishCandle() ? bearishType : neutralType
|
||||
|
||||
//
|
||||
prevCandleType = not na(candleType[1]) ? candleType[1] : neutralType
|
||||
|
||||
//
|
||||
candleNeighborhoodBaseType = prevCandleType + candleType
|
||||
/////////////////////////////
|
||||
// END Price Action Candles
|
||||
/////////////////////////////
|
||||
|
||||
///////////////////////////////
|
||||
// START Range Filter Buy Sell
|
||||
///////////////////////////////
|
||||
//
|
||||
// Source
|
||||
RFBSSrc = close
|
||||
|
||||
//
|
||||
// Sampling Period
|
||||
RFBSPer = 41
|
||||
|
||||
//
|
||||
// Range Multiplier ...
|
||||
RFBSMult = 3.0
|
||||
|
||||
//
|
||||
// Color variables ...
|
||||
RFBSUpColor = color.green
|
||||
RFBSMidColor = color.blue
|
||||
RFBSDownColor = color.red
|
||||
|
||||
//
|
||||
RFBSSmrng = smoothAverageRange(RFBSSrc, RFBSPer, RFBSMult)
|
||||
RFBSFilt = rangeFilter(RFBSSrc, RFBSSmrng)
|
||||
|
||||
//
|
||||
// Filter UP Direction ...
|
||||
RFBSUpward = 0.0
|
||||
RFBSUpward := RFBSFilt > RFBSFilt[1] ? nz(RFBSUpward[1]) + 1 : RFBSFilt < RFBSFilt[1] ? 0 : nz(RFBSUpward[1])
|
||||
|
||||
//
|
||||
// Filter DOWN Direction ...
|
||||
RFBSDownward = 0.0
|
||||
RFBSDownward := RFBSFilt < RFBSFilt[1] ? nz(RFBSDownward[1]) + 1 : RFBSFilt > RFBSFilt[1] ? 0 : nz(RFBSDownward[1])
|
||||
|
||||
//
|
||||
// Target Bands
|
||||
RFBSHband = RFBSFilt + RFBSSmrng
|
||||
RFBSLband = RFBSFilt - RFBSSmrng
|
||||
|
||||
//
|
||||
// Colors
|
||||
RFBSFiltcolor = RFBSUpward > 0 ? RFBSUpColor : RFBSDownward > 0 ? RFBSDownColor : RFBSMidColor
|
||||
RFBSBarcolor = RFBSSrc > RFBSFilt and RFBSSrc > RFBSSrc[1] and RFBSUpward > 0 ? RFBSUpColor : RFBSSrc > RFBSFilt and RFBSSrc < RFBSSrc[1] and RFBSUpward > 0 ? RFBSUpColor : RFBSSrc < RFBSFilt and RFBSSrc < RFBSSrc[1] and RFBSDownward > 0 ? RFBSDownColor : RFBSSrc < RFBSFilt and RFBSSrc > RFBSSrc[1] and RFBSDownward > 0 ? RFBSDownColor : RFBSMidColor
|
||||
|
||||
//
|
||||
// Break Outs
|
||||
RFBSLongCond = bool(na)
|
||||
RFBSShortCond = bool(na)
|
||||
RFBSLongCond := RFBSSrc > RFBSFilt and RFBSSrc > RFBSSrc[1] and RFBSUpward > 0 or RFBSSrc > RFBSFilt and RFBSSrc < RFBSSrc[1] and RFBSUpward > 0
|
||||
RFBSShortCond := RFBSSrc < RFBSFilt and RFBSSrc < RFBSSrc[1] and RFBSDownward > 0 or RFBSSrc < RFBSFilt and RFBSSrc > RFBSSrc[1] and RFBSDownward > 0
|
||||
|
||||
//
|
||||
RFBSCondIni = 0
|
||||
RFBSCondIni := RFBSLongCond ? 1 : RFBSShortCond ? -1 : RFBSCondIni[1]
|
||||
RFBSLongCondition = RFBSLongCond and RFBSCondIni[1] == -1
|
||||
RFBSShortCondition = RFBSShortCond and RFBSCondIni[1] == 1
|
||||
///////////////////////////////
|
||||
// END Range Filter Buy Sell
|
||||
///////////////////////////////
|
||||
|
||||
///////////////////////////////
|
||||
// START Stochastic Histogram
|
||||
///////////////////////////////
|
||||
//
|
||||
STHSLength = 14
|
||||
STHSSmoothK = 3
|
||||
|
||||
//
|
||||
STHSK = (ta.sma(ta.stoch(close, high, low, STHSLength), STHSSmoothK) - 50)
|
||||
///////////////////////////////
|
||||
// END Stochastic Histogram
|
||||
///////////////////////////////
|
||||
|
||||
///////////////////////
|
||||
// START Strategy ...
|
||||
///////////////////////
|
||||
//
|
||||
canShowStopLoss = showSignals and showStopLosses and (showLongSignals or showShortSignals) and (showLongStopLosses or showShortStopLosses)
|
||||
canShowLongStopLoss = canShowStopLoss and showLongStopLosses and not na(RFBSLongCondition)
|
||||
canShowShortStopLoss = canShowStopLoss and showShortStopLosses and not na(RFBSShortCondition)
|
||||
|
||||
//
|
||||
hasSignal = RFBSLongCondition or RFBSShortCondition
|
||||
|
||||
//
|
||||
// Stochastic Verification ...
|
||||
isStochasticLongVerified = STHSK > 0
|
||||
isStochasticShortVerified = STHSK < 0
|
||||
|
||||
//
|
||||
// and open > RFBSFilt ...
|
||||
// and close > RFBSFilt ...
|
||||
hasLongSignal = hasSignal and not na(RFBSLongCondition) and open > RFBSFilt and isBullishCandle() and isStochasticLongVerified
|
||||
longSignal = hasLongSignal ? RFBSLongCondition : na
|
||||
longStopLoss = RFBSLband
|
||||
|
||||
//
|
||||
hasShortSignal = hasSignal and not na(RFBSShortCondition) and isBearishCandle() and isStochasticShortVerified
|
||||
shortSignal = hasShortSignal ? RFBSShortCondition : na
|
||||
shortStopLoss = RFBSHband
|
||||
|
||||
//
|
||||
canShowSignal = showSignals and (showLongSignals or showShortSignals)
|
||||
canShowLongSignal = canShowSignal and showLongSignals and hasLongSignal
|
||||
canShowShortSignal = canShowSignal and showShortSignals and hasShortSignal
|
||||
///////////////////////
|
||||
// END Strategy ...
|
||||
///////////////////////
|
||||
//
|
||||
// END Calculations ....
|
||||
//
|
||||
|
||||
//
|
||||
// START Plots ....
|
||||
//
|
||||
//
|
||||
// Signals ...
|
||||
plotshape(canShowLongSignal ? longSignal : na, title = "Long Signal", color = longColor, location = location.belowbar, style = shape.triangleup, size = size.normal)
|
||||
plotshape(canShowShortSignal ? shortSignal : na, title = "Short Signal", color = shortColor, location = location.abovebar, style = shape.triangledown, size = size.normal)
|
||||
|
||||
//
|
||||
plot(series = showRangeFilter ? RFBSFilt : na, color = RFBSFiltcolor, linewidth = 2, title = "RFBS > Range Filter", style = plot.style_line)
|
||||
|
||||
//
|
||||
// Stop Losses ...
|
||||
plot(series = canShowLongStopLoss ? longStopLoss : na, color = longStopLossColor, linewidth = 1, style = plot.style_line, title = "Long Stop Loss")
|
||||
plot(series = canShowShortStopLoss ? shortStopLoss : na, color = shortStopLossColor, linewidth = 1, style = plot.style_line, title = "Short Stop Loss")
|
||||
//
|
||||
// END Plots ....
|
||||
//
|
||||
|
||||
//
|
||||
// START Alerts ...
|
||||
//
|
||||
alertcondition(hasSignal, "XST_RF15M > Signal")
|
||||
alertcondition(hasLongSignal, "XST_RF15M > Long Signal")
|
||||
alertcondition(hasShortSignal, "XST_RF15M > Short Signal")
|
||||
//
|
||||
// END Alerts ...
|
||||
//
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// TODOS:
|
||||
// -------
|
||||
// - []
|
||||
//////////////////////////////////////////////////////
|
||||
Reference in New Issue
Block a user