Author Message:
How to use / trade the Ladder Trader:
-------------------------------------------------
The idea is to set the auto-stepping ladder to a higher timeframe, the "ladder view" helps simplify the price action to show a clear direction, then use the lower timeframe to find best entries (close or at the ladder line) and exits (on the ATR as TP target)
- Entries should be as close to the ladder line as possible - a trader may decide to have a small margin above or below the ladder line where they set entry limit order
- note that when stepping is enabled, the auto-stepping algo will choose the step value based on the underlying price range and the selected timeframe to move with common trader "mental values" where traders will usually gravitate
- exits can be set using the optional ATR or Pct channels - by default, there's an ATR channel (gray color) for that purpose
Possible usage scenarios of the Ladder Trader:
--------------------------------------------------------------
- Trend / long(er) term: enter position once the ladder line switches to the color corresponding to my desired direction (example: blue for long), and hold all the way until the color changes
- Swing: Take only trades in the direction of the ladder (long with blue, short with orange) - enter at the ladder line value, set TP at the desired ATR, repeat as long as the direction holds
- Feel free to experiment and share back other uses you find. There are so many settings and tweaks provided for flexibility - the downside is this adds a certain level of complexity - however, i hope this will be a valuable tool to add to your trading.
Few Notes:
-----------------------
- The Auto-stepping algo is a bit improved to be more FOREX and Crypto-friendly - i do not trade these instruments myself, but will continue to improve the auto-stepping technique in upcoming updates
- the signal line (hidden by default, and is what causes the ladder to change color) is based on my Compound Ratio Moving Average - since it's the moving average i found to provide best combination of speed and smoothness. It is used as a proxy to the price, to signal when the price is above or below the ladder level - while removing some of the whipsaws if we use the price value directly.
- Broader analysis of price action should still be made using other indicators - and possibly other chart setups - we shouldn't rely on the Ladder Trader signal only - Check for overall momentum, volume movement and market sentiment before using the Ladder Trader
- Also test your settings in PaperMoney - i noticed that different instruments may need different settings (for Ladder Type, Length, Rounding Technique, ATR multiplier..etc) for optimal setup that shows best signals.. Get very familiar with the Ladder Trader and it should hopefully become more helpful to you as a tradiing tool.
CODE:
CSS:
#// © RedKTrader
#https://www.tradingview.com/script/jja8TYjc-RedK-Auto-Stepping-Ladder-Trader/
#indicator(title='RedK Auto-Step Ladder Trader', shorttitle='Ladder_Trader v2.0',
#// step function (version 2)
#// this function picks a step size based on the price range
#// it will then scale the step value up/down based on TF changes
#// change and personalize these ranges as needed
#f_step(x, TimeFrame) =>
script f_step {
input x = close;
input TimeFrame = AggregationPeriod.FIFTEEN_MIN;
def initstep =
if x < 2 then 0.01 else if x < 5 then 0.02 else
if x < 10 then 0.10 else if x < 30 then 0.20 else
if x < 100 then 1 else if x < 300 then 2 else
if x < 500 then 5 else if x < 1000 then 10 else
if x < 2000 then 20 else if x < 5000 then 50 else
if x < 10000 then 100 else if x < 20000 then 200 else
if x < 50000 then 500 else 1000.0;
def agg = TimeFrame;
# //Adjust step value up or down for different timeframes
def adjstep = if agg == AggregationPeriod.WEEK then initstep * 2 else
if agg == AggregationPeriod.MONTH then initstep * 5 else
if (agg > AggregationPeriod.HOUR and agg < AggregationPeriod.WEEK) then initstep / 2 else
if agg <= AggregationPeriod.HOUR then initstep / 5 else initstep;
def _newstr = if adjstep == 4 then 5 else adjstep;
plot return = _newstr;
}
#f_rounding(_value, _step, _option) =>
script f_rounding {
input _value = close;
input _step = 1;
input _option = "'Round up/down";
def f_rounding = if _option == "Round up/down" then round(_value / _step,0) * _step else
RoundDown(_value / _step,0) * _step;
plot return = f_rounding;
}
#// Compund Ratio Moving Average function
#f_CoraWave(_source, _length, _s) =>
script f_CoraWave {
input _source = hlc3;
input _length = 10;
input _s = 3;
def numerator; def denom;
def r_multi = 2.0;
def Start_Wt = 0.01;
def End_Wt = _length;
def r = power(End_Wt / Start_Wt, 1 / (_length - 1)) - 1;
def base = 1 + r * r_multi;
numerator = fold i = 0 to _length - 1 with p do
p + _source[i] * (Start_Wt * power(base, _length - i));
denom = fold j = 0 to _length - 1 with q do
q + (Start_Wt * power(base, _length - j));
def cora_raw = numerator / denom;
def cora_wave = wma(cora_raw, _s);
plot return = cora_wave;
}
#//---- inputs
input UseChartTime = yes;
input ShowSignalCross = no;
input MTF = AggregationPeriod.FIFTEEN_MIN;
input avgtype = {"Compund Ratio", Default "Donchian Midline"}; # 'Ladder Line'
input length = 10;
input ComRatioPrice = hlc3;# '(CoRa Only) Source'
input smooth = 3; # 'Smoothing for Cora Only')
input UseStep = yes; # inline='Step', group='Step')
input StepSize = 0; #'Step Size [0 = Auto]''Step')
input StepCalculation = {Default "Round up/down", "Whole Step"}; #'Step Calculation'
input SigSource = hlc3; # inline='Signal', group='Signal')
input SignalLength = 5; # (title='Length', inline='Signal', group='Signal')
input SignalSmooth = 3; # (title='Smooth'inline='Signal', group='Signal')
input ShowAtrBand = yes; # 'ATR Envelope'
input ATRLength = 20; # 'ATR Envelope Length'
input AtrMulti = 1.25; # 'ATR Multi'
input ShowPctBand = no; # 'Pct Envelope'
input percentage = 2.0; # 'Pct Envelope %'
#//------ Calculation
def na = Double.NaN;
def c; def h; def l; def tfPrice; def tfSigPrice;
if UseChartTime {
c = close;
h = high;
l = low;
tfPrice = ComRatioPrice;
tfSigPrice = SigSource;
} else {
c = close(Period = MTF);
h = high(Period = MTF);
l = low(Period = MTF);
tfPrice = hlc3(Period = MTF);
tfSigPrice = hlc3(Period = MTF);}
#// Ladder Line calculation
def ladder = if avgtype == avgtype."Compund Ratio" then f_CoraWave(tfPrice, length, smooth) else
(highest(h,length) + lowest(l,length)) / 2;
def s_apply = UseStep and tfPrice > 0.01;
def s = if s_apply then if StepSize == 0 then
f_step(tfPrice, if(UseChartTime,GetAggregationPeriod(),MTF)) else StepSize else 0;
def ladder_s = if s_apply and s > 0.0 then f_rounding(ladder, s, StepCalculation) else ladder;
def Signal = f_CoraWave(tfSigPrice, SignalLength, SignalSmooth);
#// Calculate Envelopes
def e_upper = ladder_s * (1 + percentage / 100);
def e_lower = ladder_s * (1 - percentage / 100);
def ATR = WildersAverage(TrueRange(h, c, l), ATRlength) * AtrMulti;
def nATR = ATR;
def ATR_us;
def ATR_ls;
ATR_us = if ladder_s != ladder_s[1] then nATR else ATR_us[1];
ATR_ls = if ladder_s != ladder_s[1] then nATR else ATR_ls[1];
def ATR_upper = ladder_s + ATR_us;
def ATR_lower = ladder_s - ATR_ls;
def c_lad = if Signal >= ladder_s then 1 else -1;
#//----Plot
plot ladderLine = ladder_s; # 'Ladder Line'
ladderLine.AssignValueColor(if c_lad>0 then CreateColor(0,188,212) else Color.DARK_ORANGE);
ladderLine.SetLineWeight(2);
plot UpperATR = if ShowAtrBand then ATR_upper else na; # 'Upper ATR Envelope'
plot LowerATR = if ShowAtrBand then ATR_lower else na; # 'Lower ATR Envelope'
UpperATR.SetDefaultColor(Color.GRAY);
LowerATR.SetDefaultColor(Color.GRAY);
plot UpperPct = if ShowPctBand then e_upper else na; # 'Upper Pct Envelope'
plot LowerPct = if ShowPctBand then e_lower else na; # 'Lower Pct Envelope'
UpperPct.SetDefaultColor(Color.GRAY);
LowerPct.SetDefaultColor(Color.GRAY);
#// --- Alert
def AlertUp = Signal crosses above ladder_s;
def AlertDn = Signal crosses below ladder_s;
plot SigUp = if ShowSignalCross and AlertUp then ladder_s else na;
plot SigDn = if ShowSignalCross and AlertDn then ladder_s else na;
SigUp.SetPaintingStrategy(PaintingStrategy.POINTS);
SigUp.SetDefaultColor(Color.CYAN);
SigUp.SetLineWeight(3);
SigDn.SetPaintingStrategy(PaintingStrategy.POINTS);
SigDn.SetDefaultColor(Color.MAGENTA);
SigDn.SetLineWeight(3);
#-----END Code