Initial Commit ...

This commit is contained in:
2024-01-25 04:07:49 +03:30
commit e24b73106d
76 changed files with 9457 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
# Support and Resistance Scalping (XTS_SR15M)
## Setup
- **TF**: 15m
- **Asset**: AAPL
- **R2R**: 1:1.5
- **Indicators**:
- Leledc Levels (IS) InSillico:
- Change Exhaustion bar count to 42;
- Change Line Tickness to 7;
- Hide Support Level line;
- Hide Resistance Level linel;
- ATR Stop Loss garethyeo:
- Change Source to low;
- **Oscillators**:
- Kurutoga Histogram (D7R):
- Hide Kurutuga Lead 4x;
## Descriptions
since Kurutoga Histogram doesn't provides it's source code, i try to implement
Cycle Channel Oscillator, instead of it.
after i try to do back testing usage of CCH and KUH, i found this rules:
- kurutuga histogram green color, means both red and green line in Cycle Channel must be above than 0.5 (Middle) line and green line above than red line.
- kurutuga histogram red color, means both red and green line in Cycle Channel must be below than 0.5 (Middle) line and red line below than green line.
so we have to implement cycle channel oscillator and it's verifications on signals ...
## Using the Strategy
### Long/Buy Conditions
- Leledc Level gives **Support Signal** (green to up side triangle);
- kurutuga histogram is **red** color;
- market forms a **bullish** candle;
#### Long SL
place sl at low of ATR Stop Loss Purple(red) Line.
#### Long TP
calculate based on R2R;
### Short/Sell Conditions
- Leledc Level gives **Resistance Signal** (red to down side triangle);
- kurutuga histogram is **green** color;
- market forms a **bearish** candle;
#### Short SL
place sl at high of ATR Stop Loss Green Line.
#### Short TP
calculate based on R2R;
### Signals Overlap
how to handle signals overlaps.
+67
View File
@@ -0,0 +1,67 @@
# XST_SR15M
## Report 1
### Makret
ETHUSDT
### Exchange
Kucoin
### Time Frame
15min
### Start Date
24 april 2023 | 01:15
### End Date
18 may 2023 | 14:45
### 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 | Long | x | | |
| 11 | Long | x | | |
| 12 | Long | | x | |
| 13 | Long | | x | |
| 14 | Long | x | | |
| 15 | Long | x | | |
| 16 | Long | | x | |
| 17 | Long | x | | |
| 18 | Long | | x | |
| 19 | Long | x | | |
| 20 | Long | x | | |
| 21 | Long | | x | |
#### Signals Results
| Type | Count | TPs | SLs |
| :-: | :-: | :-: | :-: |
| Shorts | 9 | 4 | 5 |
| Longs | 12 | 7 | 5 |
| Total | 21 | 11 | 10 |
#### Analysis
per trade volume: 10$
total spending: 210$
total comeback: 165$
+353
View File
@@ -0,0 +1,353 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center XTrade SR15M Strategy
// ---------------------------------------------
// in this strategy i must use:
// - Price Action Candle Recognition;
// - Leledc Levels (IS) InSillico;
// - ATR Stop Loss garethyeo;
// - Cycle Channel Oscillator;
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm XTrade SR15M Strategy", shorttitle = "XST_SR15M", 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")
showSupportResistance = input.bool(defval = false, title = "Show Support and Resistance", 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 Leledc Levels
///////////////////////
//
Lelec(bars, len) =>
//
result = 0
bindex = int(na)
bindex := nz(bindex[1], 0)
sindex = int(na)
sindex := nz(sindex[1], 0)
//
bindex := close > close[4] ? bindex + 1 : bindex
sindex := close < close[4] ? sindex + 1 : sindex
//
lowest = ta.lowest(low, len)
highest = ta.highest(high, len)
//
if bindex > bars and close < open and high >= highest
bindex := 0
result := -1
result
else
if sindex > bars and close > open and low <= lowest
sindex := 0
result := 1
result
///////////////////////
// END Leledc Levels
///////////////////////
//
// END Functions ....
//
//
// START Calculations ....
//
//
var shortColor = color.red
var longColor = color.lime
//////////////////////////////
// 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 Leledc Levels
///////////////////////
//
LLBars = 42
LLLength = 40
LLLevelSwitch = true
LLThicknesSwitch = 7
LLExhaustionSwitch = true
//
// Out C ...
Lelex = Lelec(LLBars, LLLength)
//
// Out Bar ...
LLHighLel = Lelex == -1 ? high : na
LLLowLel = Lelex == 1 ? low : na
//
// Out level ...
LLResistance = float(na)
LLSupport = float(na)
LLResistance := close < open and Lelex ? high : LLResistance[1]
LLSupport := close > open and Lelex ? low : LLSupport[1]
//
// Resistance Color ...
LLResistanceColor = shortColor
LLHighColor = ta.change(LLResistance) == 0 ? LLResistanceColor : na
//
// Support Color ...
LLSupportColor = longColor
LLLowColor = ta.change(LLSupport) == 0 ? LLSupportColor : na
//
// Has Signal ...
LLHasSignal = LLExhaustionSwitch
//
// Up Signals ...
LLUpSignal = LLHasSignal ? LLLowLel : na
//
// Down Signals ...
LLDownSignal = LLHasSignal ? LLHighLel : na
///////////////////////
// END Leledc Levels
///////////////////////
///////////////////////
// START ATR Stop Loss
///////////////////////
//
ATRSLSource = low
ATRSLLength = 14
ATRSLMultiplier = 1.6
//
ATRSLLongStopLoss = ATRSLSource - ta.atr(ATRSLLength) * ATRSLMultiplier
ATRSLShortStopLoss = ATRSLSource + ta.atr(ATRSLLength) * ATRSLMultiplier
///////////////////////
// END ATR Stop Loss
///////////////////////
///////////////////////
// START Cycle Channel
///////////////////////
//
CCHSclT = 10
CCHMclT = 30
CCHScm = 1.0
CCHMcm = 3.0
CCHSrc = close
CCHEbc = false
//
CCHScl = CCHSclT / 2
CCHMcl = CCHMclT / 2
//
CCHMaScl = ta.rma(CCHSrc, CCHScl)
CCHMaMcl = ta.rma(CCHSrc, CCHMcl)
//
CCHScmOff = CCHScm * ta.atr(CCHScl)
CCHMcmOff = CCHMcm * ta.atr(CCHMcl)
//
CCHScl2 = CCHScl / 2
CCHMcl2 = CCHMcl / 2
//
CCHSct = nz(CCHMaScl[CCHScl2], CCHSrc) + CCHScmOff
CCHScb = nz(CCHMaScl[CCHScl2], CCHSrc) - CCHScmOff
//
CCHMct = nz(CCHMaMcl[CCHMcl2], CCHSrc) + CCHMcmOff
CCHMcb = nz(CCHMaMcl[CCHMcl2], CCHSrc) - CCHMcmOff
//
CCHScmm = math.avg(CCHSct, CCHScb)
//
CCHOmed = (CCHScmm - CCHMcb) / (CCHMct - CCHMcb)
CCHOshort = (CCHSrc - CCHMcb) / (CCHMct - CCHMcb)
//
CCHBc = (CCHOshort > 0.5) ? (CCHOshort > 1.0 ? color.purple : (CCHOshort > CCHOmed ? color.lime : color.green)) : (CCHOshort < 0 ? color.purple : ( CCHOshort < CCHOmed ? color.red : color.orange))
///////////////////////
// END Cycle Channel
///////////////////////
///////////////////////
// START Strategy ...
///////////////////////
//
canShowStopLoss = showSignals and showStopLosses and (showLongSignals or showShortSignals) and (showLongStopLosses or showShortStopLosses)
canShowLongStopLoss = canShowStopLoss and showLongStopLosses and not na(ATRSLLongStopLoss)
canShowShortStopLoss = canShowStopLoss and showShortStopLosses and not na(ATRSLShortStopLoss)
//
// retrieve verification from CCH ...
//
// Red Line ...
fastLine = CCHOshort
// plot(fastLine, color = color.red)
//
// Green Line ...
slowLine = CCHOmed
// plot(slowLine, color = color.green)
//
// CCH Long Verification ...
isLongPositionVerifiedByCCH = fastLine < 0.5 and slowLine < 0.5 and fastLine < slowLine
//
// CCH Short Verification ...
isShortPositionVerifiedByCCH = fastLine > 0.5 and slowLine > 0.5 and fastLine > slowLine
//
hasSignal = LLHasSignal
//
hasLongSignal = hasSignal and not na(LLUpSignal) and isLongPositionVerifiedByCCH and isBullishCandle()
longSignal = hasLongSignal ? LLUpSignal : na
//
hasShortSignal = hasSignal and not na(LLDownSignal) and isShortPositionVerifiedByCCH and isBearishCandle()
shortSignal = hasShortSignal ? LLDownSignal : na
//
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)
//
// Stop Losses ...
plot(series = canShowLongStopLoss ? ATRSLLongStopLoss : na, color = color.fuchsia, linewidth = 1, style = plot.style_stepline, title = "Long Stop Loss")
plot(series = canShowShortStopLoss ? ATRSLShortStopLoss : na, color = color.aqua, linewidth = 1, style = plot.style_stepline, title = "Short Stop Loss")
//
// Support and Resistance level ...
plot(showSupportResistance and LLLevelSwitch ? LLSupport : na, title = "Support Level", style = plot.style_line, color = LLLowColor, linewidth = LLThicknesSwitch)
plot(showSupportResistance and LLLevelSwitch ? LLResistance : na, title = "Reistance Level", style = plot.style_line, color = LLHighColor, linewidth = LLThicknesSwitch)
//
// END Plots ....
//
//
// START Alerts ...
//
alertcondition(hasSignal, "XST_SR15M > Signal")
alertcondition(hasLongSignal, "XST_SR15M > Long Signal")
alertcondition(hasShortSignal, "XST_SR15M > Short Signal")
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////